googlesamples / google-services

A collection of quickstart samples demonstrating the Google APIs for Android and iOS
https://developers.google.com
Apache License 2.0
3.08k stars 2.53k forks source link

App crash onActivityResult GoogleSignInApi #240

Open hendrawd opened 8 years ago

hendrawd commented 8 years ago

It is the library that i used:

compile 'com.google.android.gms:play-services-auth:9.0.0'

Here is the code for sign in

Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);

And here the code onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        if (resultCode == RESULT_OK) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            handleSignInResult(result);
        } else {
            showSignInFailedMessage();
        }
    }
} 

Stack trace:

Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.myapp/com.myapp.activity.LoginActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data=null} to activity {com.myapp/com.myapp.activity.LoginActivity}: java.lang.NullPointerException
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2583)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2611)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2097)
       at android.app.ActivityThread.access$600(ActivityThread.java:133)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4810)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data=null} to activity {com.myapp/com.myapp.activity.LoginActivity}: java.lang.NullPointerException
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3149)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2570)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2611)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2097)
       at android.app.ActivityThread.access$600(ActivityThread.java:133)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4810)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.NullPointerException
       at com.google.android.gms.internal.zznu.onCreate(Unknown Source)
       at com.google.android.gms.internal.zzpc.zza(Unknown Source)
       at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:176)
       at com.myapp.activity.BaseActivity.onActivityResult(BaseActivity.java:40)
       at com.myapp.activity.LoginActivity.onActivityResult(LoginActivity.java:165)
       at android.app.Activity.dispatchActivityResult(Activity.java:5192)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3145)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2570)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2611)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2097)
       at android.app.ActivityThread.access$600(ActivityThread.java:133)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4810)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
       at dalvik.system.NativeStart.main(NativeStart.java)

screen shot 2016-06-21 at 3 01 06 pm

hmedat commented 8 years ago

+1

idanakav commented 8 years ago

+1

samtstern commented 8 years ago

Can anyone reliably reproduce this bug? I would be happy to investigate further if there is a way to make it happen, but right now I don't have much to go on.

phantuanphong commented 8 years ago

Similar me

hendrawd commented 8 years ago

@samtstern I got the error from Crashlytics dashboard, and it is from my users. I don't know how to reproduce the bug reliably :(

manthan5493 commented 8 years ago

I got same issue on Xiaomi Mi 3w os is 6.0.1 but i got issue because i didnt check resultCode == RESULT_OK

hendrawd commented 8 years ago

@manthan5493 It still happens too even we check for RESULT_OK. This is the code snippet from my onActivityResult

if (requestCode == RC_SIGN_IN) {
    if (resultCode == RESULT_OK) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        handleSignInResult(result);
    } else {
        CustomLogger.showLog(this, "Result from on activity result is not ok " + resultCode);
        showSignInFailedMessage();
    }
}
indraazimi commented 8 years ago

I got same issue too from my users: Android 5.0 on Xiaomi Mi 4i (ferrari) Android 5.1 on Xiaomi Mi 4c (libra)

Library that I used: compile 'com.google.android.gms:play-services-auth:9.0.2'

Any solutions?

samtstern commented 8 years ago

@indraazimi @manthan5493 this seems to be isolated to Xiaomi devices (I don't think it's a coincidence). Does either of you know if there are any particular modifications common to those devices? Are those users in China? I don't have any Xiaomi devices handy.

olx-gaurav-mishra commented 8 years ago

It happens in samsung devices as well

samtstern commented 8 years ago

@olx-gaurav-mishra are you able to reproduce this? If so that would be extremely helpful, we need to capture some additional logs.

As for the Xiaomi devices, it appears to me after some research that Xiaomi devices don't support Google Play Services natively and Play Services must be side loaded. If that's the case, I would not be surprised to see this and other strange failures happening.

olx-gaurav-mishra commented 8 years ago

Well its not reproducible directly....you can only find crashes on crashlytics.....:-(

jrgonzalezg commented 8 years ago

This deliverResults flavor of issues (many very similar but slightly different crashes) is by far the main reason for crashes on our apps in Crashlytics. It seems to be related to old versions of the Google Play Services on the user's devices. It happens a lot every time we update the Google Play Services dependency and it gradually reduces over time. It is probably also related to using GoogleApiClient::enableAutoManage() and it indeed occurs on many devices not just Xiaomi. It also does not depend on the user's location since we are seeing it a lot for users currently in Spain. Additionally, this kind of crashes did not occur some months ago, but i am not sure if it only affects newer Google Play Services versions or if it started to occur due to switching from manual handling to the enableAutoManage() calls.

imidhuntv commented 8 years ago

+1

imidhuntv commented 8 years ago

Some of my users are also experiencing the same issue. For my users it happens for Xaiomi devices. Mi 4i (Android version 5.0.2) - 57% Redmi Note 3 (Android version 5.1.1) - 29% MI MAX (Android version 6.0.1) - 14 % Any fix?

samtstern commented 8 years ago

@imidhuntv thanks for the additional reports. Since Xiaomi devices do not natively support Google Play Services I don't believe there's anything we can do for those users. It's hard to know what version of Play Services they are running and if they got the APK from a trusted source.

If anyone can reproduce this on a non-Xiaomi device that would be hugely valuable to investigating.

olx-gaurav-mishra commented 8 years ago

I removed enable auto manage and the crashes have reduced a lot...now it is crashing very less

jrgonzalezg commented 8 years ago

@olx-gaurav-mishra Thanks for confirming that!

With respect to the affected devices, just by looking at a few of the crashes related to this i see at least several Samsung, LG and Huawei devices, although few of them seem to be the latest devices from these manufacturers. Still some of them are popular devices like the S6, and there are surely more devices on the remaining issues i have in Crashlytics since they are so many due to small differences like line number offsets on the platform classes through the Android versions.

It seems to me that it may be possible to at least stop sending those "results" mentioned in the crashes if they are being sent by the auto manage features of Google Play services, by doing some null checks before sending them.

samtstern commented 8 years ago

@olx-gaurav-mishra that's very interesting. I will mention that to the team as well, see if that gives them any hint as to where to look.

Also would you mind sharing the code of the Activity you were using with enableAutoManage?

KushGoyal commented 8 years ago

@olx-gaurav-mishra how do you implement signin without enableAutoManage?

paisrikanth commented 8 years ago

+1 I see the same crash logs on my crashlytics.. the device is Samsung

olx-gaurav-mishra commented 8 years ago

@KushGoyal u need to remove enableautomanage line from code and start using lifecycle callbacks for activity/fragment to connect disconnect GoogleApiclient. Refer to https://developers.google.com/identity/sign-in/android/sign-in the highlighted blue section. I did it by connecting GoogleAPIClient in onStart and disconnecting in onStop

samtstern commented 8 years ago

Can anyone in this thread make this happen on a device they own and capture a bugreport after? The Google Sign In team (and the GoogleApiClient authors) are trying to debug this but can't get everything from the stack trace.

jrgonzalezg commented 8 years ago

I can not reproduce it directly but i have observed a few more things that may help.

Firstly, it is not specific to the sign-in apis. I have an app that only uses the app invite and the location apis (but not sign-in) and it happens there too.

Secondly, some of the related crashes can be catched by surrounding the call to super.onActivityResult(requestCode, resultCode, data) with a try-catch. If i report the issues occurring there as non-fatals i get slighty different stack traces like this (i have renamed the line mentioning my actual activity and source file to not reference the affected apps):

Non-fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.google.android.gms.common.ConnectionResult.c()' on a null object reference
       at com.google.android.gms.internal.zzqd.onCreate(Unknown Source)
       at com.google.android.gms.internal.zzrn.onActivityResult(Unknown Source)
       at android.support.v4.app.FragmentActivity.onActivityResult(SourceFile:165)
       at MyActivity.onActivityResult(SourceFile:Line)
       at android.app.Activity.dispatchActivityResult(Activity.java:6320)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3836)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3223)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3268)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2517)
       at android.app.ActivityThread.access$1200(ActivityThread.java:165)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5593)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

No other code from my activity is executed when this second flavor of exceptions occurs besides calling super.onActivityResult().

Finally, i have a feeling that this crashes are not repeating continuously because users very rarely complain about crashes on the app ratings. It may be that it only occurs the first time the Google Play Services check is performed or that it occurs on a background thread and it is not noticeable. But i definitely would expect more users complaining and it is not the case. Do the other developers here also have the same experience with this?

Hope any of this helps to narrow the issues a bit!

samtstern commented 8 years ago

@jrgonzalezg that's super helpful, thanks for all of that. Will pass it on.

aaronj1335 commented 8 years ago

@jrgonzalezg yes thank you very much!

What version of the play-services dependencies are you using?

jrgonzalezg commented 8 years ago

Great!, i am glad that's useful since it would be very good to see this fixed.

About the version, that stack trace is quite recent so it was using play-services 9.6.1 but it also happened on several previous versions. Also, not all of the errors can be catched there, some of them lead to stack traces more similar to the one posted by @hendrawd that do not go through any of the app code.

jrgonzalezg commented 8 years ago

Another one with play services 9.4.0:

Non-fatal Exception: java.lang.NullPointerException
       at com.google.android.gms.internal.zzpn.onCreate(Unknown Source)
       at com.google.android.gms.internal.zzqv.onActivityResult(Unknown Source)
       at android.support.v4.app.FragmentActivity.onActivityResult(SourceFile:165)
       at MyActivity.onActivityResult(SourceFile:Line)
       at android.app.Activity.dispatchActivityResult(Activity.java:5423)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3518)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2870)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2912)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2334)
       at android.app.ActivityThread.access$800(ActivityThread.java:145)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
       at android.os.Handler.dispatchMessage(Handler.java:102)

And a sample of one of the not catchable exceptions (play services 9.6.1):

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity {MY_APPLICATION_ID/com.google.android.gms.common.api.GoogleApiActivity}: java.lang.NullPointerException
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3162)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3205)
       at android.app.ActivityThread.access$1100(ActivityThread.java:138)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:4787)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
       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:5192)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3158)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3205)
       at android.app.ActivityThread.access$1100(ActivityThread.java:138)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:4787)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
       at dalvik.system.NativeStart.main(NativeStart.java)
wingjay commented 8 years ago

So do we have a way to prevent crash in play service 9.4.0? Thank you.

Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.glow.android.eve/com.glow.android.eve.ui.landing.WelcomeActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data=null} to activity {com.glow.android.eve/com.glow.android.eve.ui.landing.WelcomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.google.android.gms.common.ConnectionResult.c()' on a null object reference
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3083)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3114)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2445)
       at android.app.ActivityThread.access$800(ActivityThread.java:162)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5422)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
Caused by java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data=null} to activity {com.glow.android.eve/com.glow.android.eve.ui.landing.WelcomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.google.android.gms.common.ConnectionResult.c()' on a null object reference
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3688)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3069)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3114)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2445)
       at android.app.ActivityThread.access$800(ActivityThread.java:162)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5422)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int com.google.android.gms.common.ConnectionResult.c()' on a null object reference
       at com.google.android.gms.internal.zzpn.onCreate(Unknown Source)
       at com.google.android.gms.internal.zzqv.zza(Unknown Source)
       at android.support.v4.app.FragmentActivity.onActivityResult(SourceFile:175)
       at com.glow.android.trion.base.BaseActivity.onActivityResult(SourceFile:231)
       at com.glow.android.eve.ui.landing.WelcomeActivity.onActivityResult(SourceFile:286)
       at android.app.Activity.dispatchActivityResult(Activity.java:6259)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3684)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3069)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3114)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2445)
       at android.app.ActivityThread.access$800(ActivityThread.java:162)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5422)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
KE7JLM commented 8 years ago

Its happening constantly on our S4, Note 5 and Nexus 6. All running 9.8.77

Strangely, one S4 works while the other does not, both are identical.

10-21 13:48:47.551 13245-13245/com.gox.smartrun E/UncaughtException: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=-1, data=Intent { (has extras) }} to activity {com.gox.smartrun/com.gox.smartrun.login.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:4053) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4096) at android.app.ActivityThread.-wrap20(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1516) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference at com.gox.smartrun.login.LoginActivity.handleSignInResult(LoginActivity.java:161) at com.gox.smartrun.login.LoginActivity.onActivityResult(LoginActivity.java:139) at android.app.Activity.dispatchActivityResult(Activity.java:6917) at android.app.ActivityThread.deliverResults(ActivityThread.java:4049) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4096)  at android.app.ActivityThread.-wrap20(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1516)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6077)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

isaisachen commented 8 years ago

@KE7JLM Your crash is different.

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference at com.gox.smartrun.login.LoginActivity.handleSignInResult(LoginActivity.java:161)

GoogleSignInAccount.getPhotoUrl returns a Uri object and it can be null.

Javadoc: Uri getPhotoUrl () Returns the photo url of the signed in user if the user has a profile picture and you built your configuration either starting from new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) } or with requestProfile() configured; null otherwise.

isaisachen commented 8 years ago

A bug report will be helpful!

And if you can share your GoogleApiClient related code snippet, it might also help (for those use GoogleApiClient. There are 2 usages here, a) APIs like firebase invite b) APIs like Google Sign In API which requires a GoogleApiClient) a) Do you build GoogleApiClient in onCreate or onStart? b) Do you call startAutoManage / stopAutoManage? If so, where? c) Do you have multiple GoogleApiClient in the same Activity?

Thanks for all your help!

manev15 commented 8 years ago

anyone got solution for this?

brendanw commented 8 years ago

Is there a way we can view the source code in the package com.google.android.gms.internal?

isaisachen commented 8 years ago

@brendanw No, it's not open sourced. Google is actively working on this, but without repro step / bug report, it might take a little longer.

imidhuntv commented 8 years ago
screen shot 2016-10-28 at 3 24 09 pm

See, All are Xaiomi devices. But in the same devices our testing team couldn't repro this. We were able to signIn without any problem. So this must be happening rarely for some reason.

niteshgoel commented 8 years ago

I am also getting the same issue all of a sudden in crashlytics many times on Redmi devices.

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=0, data=null} to activity {com.invitesu.invitation/com.wedding.invitation.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.auth.api.signin.d.c()' on a null object reference
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3595)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3638)
       at android.app.ActivityThread.access$1300(ActivityThread.java:154)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5290)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.auth.api.signin.d.c()' on a null object reference
       at com.wedding.invitation.social.GPlusUtilNew.handleSignInResult(GPlusUtilNew.java:1113)
       at com.wedding.invitation.LoginActivity.onActivityResult(LoginActivity.java:117)
       at android.app.Activity.dispatchActivityResult(Activity.java:6241)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:3591)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3638)
       at android.app.ActivityThread.access$1300(ActivityThread.java:154)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5290)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
mobiRic commented 8 years ago

To add to this issue, I'm getting the same null pointer in the same places, but I'm only using Google Maps.

This is not a Xiaomi problem:

As with other posters, we can't replicate it in our office, but are seeing reports on Crashlytics.

We launched with Google Maps in April, and these crashes only started coming in at the beginning of October, just after we upgraded Google Play SDK from v8.4.0 to v9.4.0. We have a v9.8.0 update pending release, but not out in production yet.


Partial stack trace showing same zzpn class as referenced in previous traces:

Caused by java.lang.NullPointerException
       at com.google.android.gms.internal.zzpn.onActivityResult(Unknown Source)
       at com.google.android.gms.internal.zzqv.onActivityResult(Unknown Source)
       at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:165)
hendrawd commented 8 years ago

@mobiRic from your report maybe the problem started between version 8.4.0 and 9.0.0, because i use version 9.0.0 and the problem exist

isaisachen commented 8 years ago

@niteshgoel Need your SDK version to tell, but doesn't look like the same issue.

isaisachen commented 8 years ago

@mobiRic and everyone, please provide your SDK version for us to de-obfuscate your stack trace. Thanks! And if anyone has a bug report, it will also be very helpful!

e.g. compile 'com.google.android.gms:play-services-auth:9.0.0'

isaisachen commented 8 years ago

@imidhuntv, for your case, it's all Xiaomi, which is an interesting case. Do you distribute your apps only through Play Store? Or you publish it to other app store as well? A bug report can tell everything, but with no bug report, I am curious to know if it happened to: a) devices without Play Store / Google Play services (e.g. they download your app from other channels) or b) devices which users install Play Store / Google Play services by themselves (either via sideloading or e.g. they download "Google Installer" and then install all of Google Services Framework / account manager / Google Play services / Play Store... by themselves

niteshgoel commented 8 years ago

@isaisachen my sdk version

compile 'com.google.android.gms:play-services-auth:8.3.0'

olx-gaurav-mishra commented 8 years ago

@isaisachen compile('com.google.android.gms:play-services-auth:9.4.0')

mobiRic commented 8 years ago

@isaisachen as I said above, this was for the v9.4.0 frameworks.

aaronj1335 commented 8 years ago

@mobiRic (or anyone seeing this crash), we've got a potential fix that landed in 9.8.0, have you had a chance to release that version of your app and see if the crashes are still happening? Thanks.

mobiRic commented 8 years ago

We released with v9.8.0 just after the 3rd November, and it is looking promising in our Crashlytics so far. If I see something similar I will return to this thread and provide a v9.8.0 stack trace. Thx

samtstern commented 8 years ago

@mobiRic thanks for the update! Hope the results stay positive.

kishorgandham commented 8 years ago

The issue persists in v9.8.0 and v10.0.0 play services.

hendrawd commented 8 years ago

I can confirm that the issue still occuring even though i use version 9.8.0