问题
I'm using Crashlytics for my android app, and I have many crashes at ActivityThread.java: android.app.ActivityThread.deliverResults
I put some stack traces here:
Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity {me.robano.android/com.google.android.gms.common.api.GoogleApiActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:3641)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3684)
at android.app.ActivityThread.access$1300(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.NullPointerException
at com.google.android.gms.common.api.GoogleApiActivity.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiActivity.onActivityResult(Unknown Source)
at android.app.Activity.dispatchActivityResult(Activity.java:5634)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3637)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3684)
at android.app.ActivityThread.access$1300(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
I'm also using google firebase in my app.
please help! thanks
回答1:
The problem is definitely in the new Google Services (9.0.0 to 9.4.0). It tries to start something that returns null to the onActivityResult
.
Probably the only way to fix this:
PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(new ComponentName(this, GoogleApiActivity.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
回答2:
Upgrading the SDK to the latest version 9.4 of the Google Play Service should fix this issue.
回答3:
This is a bug in the Google Play Services SDK, up to 9.4.0. The fix should be in the next release, sorry about that.
来源:https://stackoverflow.com/questions/38418397/java-lang-nullpointerexception-at-googleapiactivity