ADT升级后不再加载Google地图视图; 明显的认证问题?

我正在开发一款使用Google地图的位置感知Android应用。 前几天我按ADT升级到23.0.0.1245622。 我想我之前在v22.6.2-1085508。

现在,地图视图仅包含Google徽标和+/-按钮。 而且,奇怪的是,我的logcat包含以下行:

07-01 12:15:08.548: E/Google Maps Android API(6299): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors). 

顺便说一下,我试过清理这个项目。 没有骰子。 我尝试在AVD而不是我的Galaxy S3上运行它。 没有骰子。 我尝试使用git reset –hard恢复到我的代码的先前版本。 仍然没有骰子。 也许最重要的是,我尝试在控制台中创建一个新的API密钥,并将其粘贴到我的清单中。 (顺便说一句,在尝试这个实验之后,我恢复了我的旧密钥,如果这一点非常重要的话。)

我将在下面发布一个完整的logcat:

 07-01 12:14:51.920: D/ActivityThread(6299): handleBindApplication:com.gregeveritt.hoodies 07-01 12:14:51.920: D/ActivityThread(6299): setTargetHeapUtilization:0.75 07-01 12:14:51.920: D/ActivityThread(6299): setTargetHeapMinFree:524288 07-01 12:14:52.560: I/Google Maps Android API(6299): Google Play services client version: 4132500 07-01 12:14:52.560: I/dalvikvm(6299): Could not find method guj.a, referenced from method gqi.a 07-01 12:14:52.560: W/dalvikvm(6299): VFY: unable to resolve static method 24932: Lguj;.a (Landroid/content/Context;)Lgri; 07-01 12:14:52.560: D/dalvikvm(6299): VFY: replacing opcode 0x71 at 0x0003 07-01 12:14:52.570: E/dalvikvm(6299): Could not find class 'gpr', referenced from method gps.a 07-01 12:14:52.570: W/dalvikvm(6299): VFY: unable to resolve new-instance 4089 (Lgpr;) in Lgps; 07-01 12:14:52.570: D/dalvikvm(6299): VFY: replacing opcode 0x22 at 0x0000 07-01 12:14:52.570: E/dalvikvm(6299): Could not find class 'gpr', referenced from method gps.a 07-01 12:14:52.570: W/dalvikvm(6299): VFY: unable to resolve new-instance 4089 (Lgpr;) in Lgps; 07-01 12:14:52.570: D/dalvikvm(6299): VFY: replacing opcode 0x22 at 0x0000 07-01 12:14:52.570: E/dalvikvm(6299): Could not find class 'gpr', referenced from method gps.a 07-01 12:14:52.570: W/dalvikvm(6299): VFY: unable to resolve new-instance 4089 (Lgpr;) in Lgps; 07-01 12:14:52.570: D/dalvikvm(6299): VFY: replacing opcode 0x22 at 0x0000 07-01 12:14:52.570: D/dalvikvm(6299): DexOpt: unable to opt direct call 0x5e9f at 0x0a in Lgps;.a 07-01 12:14:52.570: D/dalvikvm(6299): DexOpt: unable to opt direct call 0x5e9f at 0x0c in Lgps;.a 07-01 12:14:52.570: D/dalvikvm(6299): DexOpt: unable to opt direct call 0x5e9f at 0x0a in Lgps;.a 07-01 12:14:52.601: I/Google Maps Android API(6299): Google Play services package version: 5082036 07-01 12:14:52.611: W/dalvikvm(6299): VFY: unable to resolve static field 20868 (t) in Lyp; 07-01 12:14:52.611: D/dalvikvm(6299): VFY: replacing opcode 0x62 at 0x000e 07-01 12:14:52.611: W/dalvikvm(6299): VFY: unable to resolve static field 20868 (t) in Lyp; 07-01 12:14:52.611: D/dalvikvm(6299): VFY: replacing opcode 0x62 at 0x000d 07-01 12:14:52.931: W/ActivityThread(6299): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader()); 07-01 12:14:52.971: I/dalvikvm(6299): Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4022 'Lgln;' 07-01 12:14:52.971: W/dalvikvm(6299): Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed 07-01 12:14:52.971: E/dalvikvm(6299): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a 07-01 12:14:52.971: W/dalvikvm(6299): VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lglt; 07-01 12:14:52.971: D/dalvikvm(6299): VFY: replacing opcode 0x1f at 0x0019 07-01 12:14:53.111: I/Adreno200-EGL(6299): : EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.059_msm8960_JB_2.5.5_CL3896081_release_AU (CL3896081) 07-01 12:14:53.111: I/Adreno200-EGL(6299): Build Date: 06/25/13 Tue 07-01 12:14:53.111: I/Adreno200-EGL(6299): Local Branch: 07-01 12:14:53.111: I/Adreno200-EGL(6299): Remote Branch: quic/jb_2.5.5 07-01 12:14:53.111: I/Adreno200-EGL(6299): Local Patches: NONE 07-01 12:14:53.111: I/Adreno200-EGL(6299): Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.059 + NOTHING 07-01 12:14:53.161: D/OpenGLRenderer(6299): Enabling debug mode 0 07-01 12:14:53.311: I/Google Maps Android API(6299): Failed to contact Google servers. Another attempt will be made when connectivity is established. 07-01 12:14:54.022: I/Choreographer(6299): Skipped 51 frames! The application may be doing too much work on its main thread. 07-01 12:14:54.723: I/Google Maps Android API(6299): Google Play services package version: 5082036 07-01 12:14:55.964: I/Choreographer(6299): Skipped 61 frames! The application may be doing too much work on its main thread. 07-01 12:14:56.304: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302027791 07-01 12:14:56.304: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302027791 07-01 12:15:08.548: E/Google Maps Android API(6299): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors). 07-01 12:15:58.571: W/IInputConnectionWrapper(6299): getExtractedText on inactive InputConnection 07-01 12:15:58.571: W/IInputConnectionWrapper(6299): getTextBeforeCursor on inactive InputConnection 07-01 12:15:58.581: W/IInputConnectionWrapper(6299): getSelectedText on inactive InputConnection 07-01 12:15:58.581: W/IInputConnectionWrapper(6299): getTextAfterCursor on inactive InputConnection 07-01 12:16:04.027: I/Google Maps Android API(6299): Google Play services package version: 5082036 07-01 12:16:04.167: W/IInputConnectionWrapper(6299): getExtractedText on inactive InputConnection 07-01 12:16:04.227: W/IInputConnectionWrapper(6299): getTextBeforeCursor on inactive InputConnection 07-01 12:16:05.468: W/IInputConnectionWrapper(6299): getSelectedText on inactive InputConnection 07-01 12:16:05.498: W/IInputConnectionWrapper(6299): getTextAfterCursor on inactive InputConnection 07-01 12:16:05.518: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302097011 07-01 12:16:51.027: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302142518 07-01 12:17:31.530: I/Google Maps Android API(6299): Google Play services package version: 5082036 07-01 12:17:32.521: I/Choreographer(6299): Skipped 49 frames! The application may be doing too much work on its main thread. 07-01 12:17:33.142: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302184634 

这是我的清单,我的api密钥被涂抹了:

                      

哦,这是我的地图创建代码:

  @Override public void onConnected(Bundle dataBundle) { Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show(); try { showNeighborhood(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // TODO potentially switch to SupportMapFragment, lower MinSDK from 12 to 11 mMap = ( (MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); CameraUpdate startingCamera = CameraUpdateFactory.newLatLng( new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()) ); mMap.moveCamera(startingCamera); // TODO What if mMap was null-checked? } 

注意:在此过程的某处,我也从32位JDK切换到64位JDK。 我怀疑这是否相关,但我只是想掩盖我的基础。

在查看user2103379的答案并检查我的API密钥时,我发现包名称和API密钥是正确的。 但是,我的新调试密钥的SHA-1未添加到接受的客户端列表中。 哎呀! 无论如何,我把新的SHA-1放在那里,清理Eclipse项目(在禁用自动后清理构建之后)并重新构建项目。 工作得很好。

问题可能正在发生,因为未加载地图并且应用程序试图在卸载的地图中找到您。 地图未加载您的api密钥或包名称。 我认为你的api密钥已经改变了。 请检查您的api密钥和包裹名称。