Google Maps Android v2授权失败
作者:互联网
我正在具有2.3.6的实际设备上测试示例google代码.我认为这可能是密钥问题,因此我通过Google的API控制台在不同的帐户上创建了不同的密钥.仍然存在相同的问题“ Google Maps Android API -授权失败”.
这是日志:
12-07 10:31:30.476: D/dalvikvm(17791): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
12-07 10:31:30.484: W/dalvikvm(17791): VFY: unable to resolve instance field 24
12-07 10:31:30.484: D/dalvikvm(17791): VFY: replacing opcode 0x52 at 0x0012
12-07 10:31:30.484: D/dalvikvm(17791): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
12-07 10:31:30.718: D/dalvikvm(17791): GC_CONCURRENT freed 197K, 46% free 3063K/5639K, external 408K/517K, paused 3ms+4ms
12-07 10:31:30.789: W/dalvikvm(17791): Unable to resolve superclass of Lmaps/a/du; (411)
12-07 10:31:30.789: W/dalvikvm(17791): Link of class 'Lmaps/a/du;' failed
12-07 10:31:30.789: W/dalvikvm(17791): Unable to resolve superclass of Lmaps/a/ej; (2363)
12-07 10:31:30.789: W/dalvikvm(17791): Link of class 'Lmaps/a/ej;' failed
12-07 10:31:30.789: W/dalvikvm(17791): Unable to resolve superclass of Lmaps/j/k; (2379)
12-07 10:31:30.789: W/dalvikvm(17791): Link of class 'Lmaps/j/k;' failed
12-07 10:31:30.789: E/dalvikvm(17791): Could not find class 'maps.j.k', referenced from method maps.y.ae.a
12-07 10:31:30.789: W/dalvikvm(17791): VFY: unable to resolve new-instance 3571 (Lmaps/j/k;) in Lmaps/y/ae;
12-07 10:31:30.789: D/dalvikvm(17791): VFY: replacing opcode 0x22 at 0x007d
12-07 10:31:30.820: D/dalvikvm(17791): VFY: dead code 0x007f-008f in Lmaps/y/ae;.a (Landroid/view/LayoutInflater;Lcom/google/android/gms/maps/GoogleMapOptions;Z)Lmaps/y/ae;
12-07 10:31:31.281: D/dalvikvm(17791): GC_CONCURRENT freed 297K, 46% free 3222K/5959K, external 408K/517K, paused 3ms+4ms
12-07 10:31:31.523: D/dalvikvm(17791): GC_EXTERNAL_ALLOC freed 227K, 45% free 3397K/6087K, external 431K/517K, paused 52ms
12-07 10:31:31.648: I/System.out(17791): 0
12-07 10:31:31.734: D/dalvikvm(17791): GC_CONCURRENT freed 188K, 43% free 3531K/6151K, external 544K/1029K, paused 5ms+4ms
12-07 10:31:32.125: D/libEGL(17791): loaded /system/lib/egl/libGLES_hgl.so
12-07 10:31:32.132: D/BRCM_EGL(17791): eglCreateContext() context: 0xd7090, VC context 1, Thread 17810
12-07 10:31:32.148: D/BRCM_EGL(17791): eglCreateWindowSurface() surface: 0xd70d0, VC surface: 1, Thread: 17810
12-07 10:31:32.148: D/BRCM_EGL(17791): eglMakeCurrent(0xd7090, 0xd70d0, 0xd70d0) Thread: 17810
12-07 10:31:32.859: E/Google Maps Android API(17791): Authorization failure.
这是我的清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.smartapps4u.googlemapslib"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission
android:name="com.smartapps4u.googlemapslib.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.smartapps4u.googlemapslib.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-library android:name="com.google.android.maps" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My API key"/>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
任何帮助,将不胜感激.
解决方法:
解决了这个问题,我这是一个非常愚蠢的错误,使用了错误的api密钥,将api密钥用于已签名的应用程序,将其替换为用于调试密钥库的api密钥,从而解决了问题.
标签:authorization,android,google-maps-api-2 来源: https://codeday.me/bug/20191031/1976554.html