google-services.json non-standart android 项目结构的集成

google-services.json integration for non-standart android project structure

我知道 google-services.json 必须在 app 目录中,我的问题是我没有这个文件夹,我的项目文件夹结构很乱。我该如何解决这个问题?我应该在哪里插入这个文件?或者如果可以将此结构转换为默认的标准 android 项目?在该项目中只有一个 build.gradle 文件

这是错误日志

    Error:Could not find com.google.gms:google-services:3.0.0.
Searched in the following locations:
    file:/opt/android-studio/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom
    file:/opt/android-studio/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar
Required by:
    :linphone-android (copy):unspecified

build.gradle

  dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.google.gms:google-services:3.0.0'
}

dependencies {
   compile fileTree(include: '*.jar', dir: 'libs')
   compile 'com.google.firebase:firebase-messaging:10.2.0'
}

在底部

apply plugin: 'com.google.gms.google-services'

这是我的项目结构

请尝试将应用程序等级文件放在那里意味着 gradle 和 json 文件应该在那里直接转到文件夹并且过去不要使用 android 工作室粘贴那个文件。 android studio 可以从那里读取 gradle 它也可以从那里读取 json

此提交已解决此问题: https://github.com/BelledonneCommunications/linphone-android/commit/da76f636ceb06daf28bc4d98db8faa044b90cbee

我们只是添加一个检查'google-services.json'是否存在并根据此添加依赖项。