gpt4 book ai didi

java - Google服务无法初始化,状态:10

转载 作者:行者123 更新时间:2023-12-03 06:03:33 27 4
gpt4 key购买 nike

我目前正在开发的应用程序上使用Google Maps,突然在手机上运行该应用程序时,我的应用程序开始出现错误。

10-22 22:19:41.921 26626-26626/? E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.



我已经看到有关此问题的类似帖子,并且我已经尝试了大多数解决方案。大多数建议在我的应用程序gradle上在 apply plugin: 'com.google.gms.google-services'的末尾添加 app.gradleclasspath 'com.google.gms:google-services:3.0.0'

我还在路径 google-services.json上添加了 app/
这些解决方案均无效,有人可以解决吗?

这些是我目前的职系
// Top-level build file where you can add configuration options common to              all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'




// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

应用特定的gradle
 apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.example.josebernhardt.rpvc_"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
}

最佳答案

ensure that your device have the Google Play Services APK

As described in the Google Play services overview, Google Play delivers service updates for users on Android 2.3 and higher through the Google Play Store app. However, updates might not reach all users immediately, so your app should verify the version available before attempting to perform API transactions.



并且如 documentation中所述,

Note: Because it is hard to anticipate the state of each device, you must always check for a compatible Google Play services APK before you access Google Play services features.



此外,您可能还想在此 SO post中尝试建议的解决方案,其中从 play-services:8.4.0更新为 play-services:9.2.0可以解决此问题。

希望有帮助!

关于java - Google服务无法初始化,状态:10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40199001/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com