我正在使用 Google Maps API v2 开发一个应用程序,我已经对其进行了测试,它在 HTC Desire 500、三星 Galaxy SIII mini 和 Mediacom Phonepad 上运行良好。但是在 Nexus 5(使用 Android Kitkat 4.4.2)上,当我单击打开“ActivityMap”的按钮时,我的应用程序崩溃了。我还安装了 Android 的 API 19。任何人都可以帮助我吗?每一种帮助都将不胜感激。如果你需要我的代码,就问我。
03-18 11:21:37.240: E/AndroidRuntime(18406): FATAL EXCEPTION: main
03-18 11:21:37.240: E/AndroidRuntime(18406): Process: com.example.myapplication, PID: 18406
03-18 11:21:37.240: E/AndroidRuntime(18406): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MapActivity}: java.lang.NullPointerException
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.os.Handler.dispatchMessage(Handler.java:102)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.os.Looper.loop(Looper.java:136)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-18 11:21:37.240: E/AndroidRuntime(18406): at java.lang.reflect.Method.invokeNative(Native Method)
03-18 11:21:37.240: E/AndroidRuntime(18406): at java.lang.reflect.Method.invoke(Method.java:515)
03-18 11:21:37.240: E/AndroidRuntime(18406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-18 11:21:37.240: E/AndroidRuntime(18406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-18 11:21:37.240: E/AndroidRuntime(18406): at dalvik.system.NativeStart.main(Native Method)
03-18 11:21:37.240: E/AndroidRuntime(18406): Caused by: java.lang.NullPointerException
03-18 11:21:37.240: E/AndroidRuntime(18406): at com.example.myapplication.MapActivity.onCreate(MapActivity.java:53)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.Activity.performCreate(Activity.java:5231)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-18 11:21:37.240: E/AndroidRuntime(18406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
03-18 11:21:37.240: E/AndroidRuntime(18406): ... 11 more