Android Google Maps API getGoogleAppId失败,状态为:10
我遵循这个Udacity获取用户Lat/Long位置值,并在TextView中显示这些值。我正在为Android启用Maps API,但在emulator(Nexus 6和Google API)上运行时收到错误消息: getGoogleAppId失败,状态为:10,但不确定如何修复此错误 我已经遵循了谷歌文档中的步骤,下面是应用程序代码 AndroidManifest.xmlAndroid Google Maps API getGoogleAppId失败,状态为:10,android,google-maps,Android,Google Maps,我遵循这个Udacity获取用户Lat/Long位置值,并在TextView中显示这些值。我正在为Android启用Maps API,但在emulator(Nexus 6和Google API)上运行时收到错误消息: getGoogleAppId失败,状态为:10,但不确定如何修复此错误 我已经遵循了谷歌文档中的步骤,下面是应用程序代码 AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xm
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.trishwhetzel.googlelocationservices" >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="MY-API-KEY"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
日志:
如果你能提供日志,那将大有帮助。但是检查出来,问题可能是API密钥不正确。您链接的谷歌地图文档似乎与Google-services.json更直接相关。你可以查看更多信息和说明。是的,我在你链接到的入门页面中遵循“获取API密钥的完整过程”。现在已将日志添加到原始帖子中。能否尝试使用
com.google.android.maps.v2.API_KEY
作为元数据名称?文档中指出,它用于向后兼容。希望这是最简单的路线。另一种选择是尝试其他方法获取Google Maps API密钥(快速简单的方法,稍微慢一点的方法),更改元数据名称不起作用。如果您可以提供日志,这将非常有帮助。但是检查出来,问题可能是API密钥不正确。您链接的谷歌地图文档似乎与Google-services.json更直接相关。你可以查看更多信息和说明。是的,我在你链接到的入门页面中遵循“获取API密钥的完整过程”。现在已将日志添加到原始帖子中。能否尝试使用com.google.android.maps.v2.API_KEY
作为元数据名称?文档中指出,它用于向后兼容。希望这是最简单的路线。另一种选择是尝试其他方法来获取GoogleMapsAPI密钥(快速简单的方法,稍微慢一点的方法),更改元数据名称不起作用。
{
"project_info": {
"project_id": "plwjava",
"project_number": "339950946077",
"name": "plwjava"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:339950946077:android:27d689d63f1b7a06",
"client_id": "android:com.google.samples.quickstart.signin",
"client_type": 1,
"android_client_info": {
"package_name": "com.google.samples.quickstart.signin"
}
},
"oauth_client": [],
"api_key": [],
"services": {
"analytics_service": {
"status": 1
},
"cloud_messaging_service": {
"status": 2,
"apns_config": []
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"google_signin_service": {
"status": 1
},
"ads_service": {
"status": 1
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:339950946077:android:e6522183029b3f29",
"client_id": "android:com.google.android.gms",
"client_type": 1,
"android_client_info": {
"package_name": "com.google.android.gms"
}
},
"oauth_client": [],
"api_key": [],
"services": {
"analytics_service": {
"status": 1
},
"cloud_messaging_service": {
"status": 2,
"apns_config": []
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"google_signin_service": {
"status": 1
},
"ads_service": {
"status": 1
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:339950946077:android:11a88aaa174bec42",
"client_id": "android:com.google.android.gms.maps",
"client_type": 1,
"android_client_info": {
"package_name": "com.google.android.gms.maps"
}
},
"oauth_client": [],
"api_key": [],
"services": {
"analytics_service": {
"status": 1
},
"cloud_messaging_service": {
"status": 2,
"apns_config": []
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"google_signin_service": {
"status": 1
},
"ads_service": {
"status": 1
}
}
}
],
"client_info": [],
"ARTIFACT_VERSION": "1"
}
12-26 15:59:57.112 2485-2485/? I/art: Not late-enabling -Xcheck:jni (already on)
12-26 15:59:57.206 2485-2485/com.trishwhetzel.googlelocationservices W/System: ClassLoader referenced unknown path: /data/app/com.trishwhetzel.googlelocationservices-2/lib/x86
12-26 15:59:57.325 2485-2505/com.trishwhetzel.googlelocationservices I/GMPM: App measurement is starting up
12-26 15:59:57.333 2485-2505/com.trishwhetzel.googlelocationservices E/GMPM: getGoogleAppId failed with status: 10
12-26 15:59:57.364 2485-2505/com.trishwhetzel.googlelocationservices E/GMPM: Uploading is not possible. App measurement disabled
12-26 15:59:57.549 2485-2510/com.trishwhetzel.googlelocationservices D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-26 15:59:57.769 2485-2510/com.trishwhetzel.googlelocationservices I/OpenGLRenderer: Initialized EGL, version 1.4
12-26 15:59:57.837 2485-2510/com.trishwhetzel.googlelocationservices W/EGL_emulation: eglSurfaceAttrib not implemented
12-26 15:59:57.837 2485-2510/com.trishwhetzel.googlelocationservices W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad760360, error=EGL_SUCCESS