相关疑难解决方法(0)

使用Google Services 3.0.0时缺少api_key /当前密钥

自从我使用最新版本的google服务和库(9.0.0)升级项目后,我遇到了这个奇怪的问题:

错误构建

等级控制台:

:app:processDebugGoogleServices
Parsing json file: /Users/cyrilmorales/Documents/Projects/mobilemeans-punainenristi/app/google-services.json
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Missing api_key/current_key object
Information:BUILD FAILED
Run Code Online (Sandbox Code Playgroud)

build.gradle(root):

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0-alpha1'
    classpath 'com.google.gms:google-services:3.0.0'
}
Run Code Online (Sandbox Code Playgroud)

build.gradle(app):

dependencies {
    ....
    compile 'com.google.android.gms:play-services-analytics:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile 'com.google.android.gms:play-services-maps:9.0.0'
    compile 'com.google.android.gms:play-services-location:9.0.0'
    ...
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

但是,它适用于8.4.0和google-services 2.1.0中的播放服务库

你对这个解决方案有什么看法吗?

android google-play-services android-gradle-plugin

156
推荐指数
6
解决办法
6万
查看次数

GCM API密钥应该保密吗?

根据文件:

不要在客户端代码中的任何位置包含API密钥.

在我们当前的Android应用程序中就是这种情况 - API Key无法包含在代码中.但是,对于新版本的3.0.0 com.google.gms:google-services库,它在Missing api_key/current_key没有它的情况下开始抛出错误,如下所述:缺少使用Google Services 3.0.0的api_key /当前密钥.

此外,Google的配置生成器https://developers.google.com/mobile/add?platform=android&cntapi=gcmgoogle-services.json文件中包含API密钥.

它应该被保密吗?或者将它包含在客户端应用程序中是否安全?

android google-cloud-messaging firebase-cloud-messaging

6
推荐指数
2
解决办法
860
查看次数