我的应用程序在Galaxy tab 8 android 5中出错

时间:2015-11-04 19:54:42

标签: android google-maps

这是我的第一篇文章,我使用谷歌地图api v2在eclipse中做了一个应用程序。该应用程序在Android 4.2.2和4.3中工作正常但在Android 5.0中该应用程序崩溃了这个错误:

java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.MapFragment.getMap()' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2790)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2855)
    at android.app.ActivityThread.access$900(ActivityThread.java:181)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6117)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.MapFragment.getMap()' on a null object reference
    at com.alezanper.reporter.F_map.MapInit(F_map.java:97)
    at com.alezanper.reporter.F_map.onCreateView(F_map.java:65)
    at android.app.Fragment.performCreateView(Fragment.java:2114)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
    at android.app.BackStackRecord.run(BackStackRecord.java:833)
    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
    at android.app.Activity.performStart(Activity.java:6411)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
    ... 10 more

1 个答案:

答案 0 :(得分:0)

您的地图似乎未正确初始化。您应该在初始化地图时通过放置断点来使用Android Studio对其进行调试,以了解发生的情况。