NullPointerException from Google maps

2019-01-07 11:10发布

问题:

I've just recently started to receive a nullpointerexception from Android google maps and I can't figure out what causes it. Currently it has only been reported on a HTC Desire 500 (z4u) device running android 4.1. Any suggestions or ideas would be greatly appreciated.

Edit:

So I've gotten my hands on a device that gives the error (HTC Desire, Android 4.1.2, HTC SDK API 5.26). As I suspected from trace it is purely internal error. Following didn't help:

  • Rebooting
  • reinstall
  • Newest version of google play services
  • Update app to use play services 8.3.0

The stack trace is seen bellow:

java.lang.RuntimeException: Unable to resume activity {dk.mobikom.android/dk.mobikom.android.activities.ContactDetailActivity}: java.lang.NullPointerException
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3036)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3077)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2373)
    at android.app.ActivityThread.access$600(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1330)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:155)
    at android.app.ActivityThread.main(ActivityThread.java:5536)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1074)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:841)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
    at com.google.maps.api.android.lib6.gmm6.m.ad.a(Unknown Source)
    at com.google.maps.api.android.lib6.gmm6.c.h.a(Unknown Source)
    at com.google.maps.api.android.lib6.gmm6.c.y.a(Unknown Source)
    at com.google.maps.api.android.lib6.e.bd.a(Unknown Source)
    at com.google.maps.api.android.lib6.e.ev.a(Unknown Source)
    at com.google.maps.api.android.lib6.e.z.a(Unknown Source)
    at com.google.maps.api.android.lib6.e.y.a(Unknown Source)
    at com.google.android.gms.maps.internal.u.onTransact(SourceFile:107)
    at android.os.Binder.transact(Binder.java:326)
    at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source)
    at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source)
    at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source)
    at com.google.android.gms.dynamic.zza.zza(Unknown Source)
    at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source)
    at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1026)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572)
    at android.support.v4.app.Fragment.performResume(Fragment.java:2012)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1189)
    at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:2011)
    at android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:187)
    at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:426)
    at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:415)
    at android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:141)
    at android.app.Activity.performResume(Activity.java:5161)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3019)
    ... 12 more

回答1:

So as suspected this is an issue at googles side. They've verified the bug and are working on a fix (2015-12-21), see googles bug tracker for up to date info about the issue.

Edit:

So I got to test Georges SD info and yes inserting a SD card solved the problem. So from this we can conclude phones that don't have an internal fake-external storage (like most phones now a days) will crash from this bug... So this might be a workaround for those who work in the enterprise segment but for those working in the consumer segment this will not really help a lot...

Edit Jan 20, 2016

A developer from the Google team has announced the fix has been made and it will be rolled out with the next major release of Google play, but they haven't set a timeline for that yet.

Edit Jun 02, 2016

A developer from the Google team has announced it is confirmed fixed:

Sorry this took so long to fix, but here is the bug fix you've been waiting for!

We can confirm that this issue is now fixed in version 9.0.83 of Google Play Services, released in May 2016.



回答2:

Ok found the solution in my case 5 hours later.

Without touching the device (HTC Desire X 4.1.1) all I did is install an SD card and the error magically disappeared. Install SD card, reboot (updated Google photos in the process by I don't think it has anything to do with the issue).

For crying out loud !



回答3:

Adding size of SD card on my Emulator worked for me.

Emulator Android



回答4:

Have u tried these

<!-- EXTERNAL_STORAGE permissions are optional for Android 6.0 onwards. -->
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="22" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="22" />

This may solve the issue.



标签: android maps