当 Google Maps API v2 突然停止工作时,一切正常。经过整整 1 天 1 夜的尝试,我仍然无法将它带回来。我做了一个简单的应用程序,它仍然无法正常工作。
我的文件如下:
package com.azimbunafar.apps.japanallthingsdirectory;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MapActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
}
}
布局文件是
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
清单文件是:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.azimbunafar.apps.japanallthingsdirectory"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<permission
android:name="com.azimbunafar.apps.japanallthingsdirectory.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.azimbunafar.apps.japanallthingsdirectory.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
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="AIzaSyCzxLRmQvoRhtxVKHcaPAacknQfJVtXSoQ" />
<activity
android:name="com.azimbunafar.apps.japanallthingsdirectory.MapActivity"
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>
我在 LogCat 中遇到的错误是
07-08 12:28:29.114: D/dalvikvm(12232): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
07-08 12:28:29.114: W/dalvikvm(12232): VFY: unable to resolve instance field 27
07-08 12:28:29.114: D/dalvikvm(12232): VFY: replacing opcode 0x52 at 0x0012
07-08 12:28:29.114: D/dalvikvm(12232): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
07-08 12:28:29.394: D/dalvikvm(12232): GC_CONCURRENT freed 209K, 45% free 3134K/5639K, external 0K/0K, paused 6ms+26ms
07-08 12:28:29.954: D/dalvikvm(12232): GC_CONCURRENT freed 350K, 45% free 3332K/5959K, external 0K/0K, paused 2ms+7ms
07-08 12:28:30.365: D/dalvikvm(12232): GC_CONCURRENT freed 334K, 43% free 3539K/6151K, external 0K/0K, paused 2ms+4ms
07-08 12:28:30.435: D/libEGL(12232): loaded /system/lib/egl/libGLES_android.so
07-08 12:28:30.455: D/libEGL(12232): loaded /system/lib/egl/libEGL_adreno200.so
07-08 12:28:30.455: W/SchedPolicy(12232): add_tid_to_cgroup failed to write '' (Invalid argument); background=0
07-08 12:28:30.465: D/libEGL(12232): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
07-08 12:28:30.475: D/libEGL(12232): loaded /system/lib/egl/libGLESv2_adreno200.so
07-08 12:28:30.585: D/dalvikvm(12232): GC_EXTERNAL_ALLOC freed 24K, 43% free 3548K/6151K, external 0K/0K, paused 50ms
07-08 12:28:31.056: D/dalvikvm(12232): GC_CONCURRENT freed 280K, 42% free 3663K/6279K, external 235K/512K, paused 2ms+3ms
07-08 12:28:31.216: I/Google Maps Android API(12232): Failed to contact Google servers. Another attempt will be made when connectivity is established.
07-08 12:28:31.606: E/Google Maps Android API(12232): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
我已经搜索了“加载地图失败。联系 Google 服务器时出错”错误的每个线程。但似乎没有任何效果。
我将不胜感激任何类型的解决方案或建议。如果您需要有关我的申请的更多信息,请告诉我。