【问题标题】:google-services.json cannot be found找不到 google-services.json
【发布时间】:2018-06-10 22:22:22
【问题描述】:

我已将 google 服务 json 文件放在 android/app/src 但是我得到了这个错误:

Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/profile, src/profile/nullnull, src/nullnull, src/profile, src/nullnullProfile]
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)

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

【问题讨论】:

标签: android flutter


【解决方案1】:

google-services.json 放在 android/app 目录中,而不是 android/app/src

【讨论】:

  • 试过了,但它现在给了我错误``失败:构建失败并出现异常。 * 出了什么问题:条目中的 null 值:incrementalFolder=null ``
  • 这应该是一个不同的问题。你只收到那条消息吗?
【解决方案2】:

试试这个

你应该在应用程序 gradle 中添加

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

你应该在下面添加依赖

dependencies {
    // Add this line
    classpath 'com.google.gms:google-services:3.0.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

google-services.json 文件,您可以从 google 控制台 下载并放在应用位置

  • 切换到项目视图,以便查看实际的项目文件夹结构。
  • 找到 google-service.json 文件并将其拖到 app 目录(出于某种原因,当我使用文件资源管理器添加它时,将其放入gradle 文件夹)。

  • 清理/重建项目。

对我有用

【讨论】:

    【解决方案3】:

    我也有同样的问题。我试过这个,它对 m 工作正常。 我认为这适用于 cordova 和 ionic 应用程序。

    https://github.com/fechanique/cordova-plugin-fcm/issues/219#issuecomment-282312015

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-11
      • 2018-05-13
      • 2019-11-27
      • 2016-03-19
      • 2016-10-04
      • 1970-01-01
      • 2019-07-08
      • 1970-01-01
      相关资源
      最近更新 更多