<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
我的 MapFragment 突然让我的 googlemap 应用程序崩溃。这发生在将 SDK 更新到 4.4 之后。当我在所有 android 设备上运行时,我所有基于 Googlemap MapFragment 的应用程序都会崩溃(注 2/3/nexus7)。google Mapv2 的所有设置都保留..例如库、API 密钥..清单权限没有任何变化。突然更新到 kitkat SDK 后,我所有的 googlemap v2 应用程序都失控了。
罗12-15 14:16:37.751: E/AndroidRuntime(20072): FATAL EXCEPTION: main
12-15 14:16:37.751: E/AndroidRuntime(20072): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dudewheresmycar/com.dudewheresmycar.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2294)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2348)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.ActivityThread.access$700(ActivityThread.java:159)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.os.Handler.dispatchMessage(Handler.java:99)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.os.Looper.loop(Looper.java:137)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.ActivityThread.main(ActivityThread.java:5414)
12-15 14:16:37.751: E/AndroidRuntime(20072): at java.lang.reflect.Method.invokeNative(Native Method)
12-15 14:16:37.751: E/AndroidRuntime(20072): at java.lang.reflect.Method.invoke(Method.java:525)
12-15 14:16:37.751: E/AndroidRuntime(20072): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
12-15 14:16:37.751: E/AndroidRuntime(20072): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
12-15 14:16:37.751: E/AndroidRuntime(20072): at dalvik.system.NativeStart.main(Native Method)
12-15 14:16:37.751: E/AndroidRuntime(20072): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
12-15 14:16:37.751: E/AndroidRuntime(20072): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.Activity.setContentView(Activity.java:1956)
12-15 14:16:37.751: E/AndroidRuntime(20072): at com.dudewheresmycar.MainActivity.onCreate(MainActivity.java:36)
12-15 14:16:37.751: E/AndroidRuntime(20072): at android.app.Activity.performCreate(Activity.java:5369)
找到了解决方案..需要在manifest.xml中插入以下标签
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
在应用程序标签中