GoogleService初始化失败,状态:10,缺少预期资源:在Android中

时间:2016-01-29 10:04:42

标签: android

签名APK低于错误

  

GoogleService初始化失败,状态:10,缺少预期资源:'R.string.google_app_id'用于初始化Google服务。可能的原因是缺少google-services.json或com.google.gms.google-services gradle插件。

当我用Dubug.APK运行相同的代码时,它运行正常。

下面是build.gradle文件

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0' }}apply plugin: 'com.google.gms.google-services''

1 个答案:

答案 0 :(得分:1)

您错过了添加google-service.json文件。据我所知,你已经在google Developer上创建了你的应用程序,你需要下载google-service.json文件并将其放入你的app文件夹

将google-service.json放到app文件夹的步骤:

1) in android studio double tap the shift button and search for terminal 
2) $ mv path-to-download/google-services.json app/ for Ubuntu/MAC OS 
3) For google-service.json use generate file button from this link 

https://developers.google.com/identity/sign-in/android/start-integrating

有关详细信息,请参阅以下链接 GoogleService failed to initialize