【问题标题】:google-services.json integration for non-standart android project structure非标准android项目结构的google-services.json集成
【发布时间】:2017-07-07 22:01:30
【问题描述】:

我知道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'

这是我的项目结构

【问题讨论】:

  • 您必须将该文件直接插入项目的 app 文件夹中,而不是来自 android studio。并请提供您的结构的更多细节和屏幕。 google-services.json 在结构中不可见,但它在您的项目文件夹中
  • 是的,我知道。我没有这个文件夹
  • 请显示您的项目结构。发布您的结构图片
  • 我已经更新了我的问题
  • 请将屏幕截图中显示的上述微调器从项目更改为 Android 并发送屏幕截图。

标签: android android-studio build.gradle linphone google-play-services


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 是的服务json和build.gradle在同一个目录,但是同样的问题
    • 做 1 想把项目的每个主要公共文件夹放在哪里,如果成功的话,你可以只放 Gradel,然后一一删除并检查
    猜你喜欢
    • 1970-01-01
    • 2019-01-07
    • 2016-03-27
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 2017-06-24
    • 1970-01-01
    相关资源
    最近更新 更多