aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
245 stars 115 forks source link

NPE on CustomTabsManagerActivity.onResume #1090

Closed yinzcam-android closed 3 years ago

yinzcam-android commented 3 years ago

Describe the bug

We are trying to setup AWS web sign-in for the Cavaliers official Android app. signInWithWebUI works fine. When we try to logout, we get the logout success callback but then it crashes.

To Reproduce When we try to signOut after signInWithWebUI

Amplify.Auth.signOut(
    () -> Log.d(TAG, "Auth: log out successfully"),
    error -> Log.e(TAG, "Auth: log out" + error.toString())
);

Environment Information (please complete the following information):

Additional context Stack trace:

2020-12-29 15:18:32.018 26833-26833/com.detroitlabs.cavaliers E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.detroitlabs.cavaliers, PID: 26833
    java.lang.RuntimeException: Unable to resume activity {com.detroitlabs.cavaliers/com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsManagerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4657)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4690)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1713)
        at android.app.Activity.startActivityForResult(Activity.java:5258)
        at android.app.Activity.startActivityForResult(Activity.java:5203)
        at android.app.Activity.startActivity(Activity.java:5587)
        at android.app.Activity.startActivity(Activity.java:5555)
        at com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsManagerActivity.onResume(CustomTabsManagerActivity.java:68)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)
        at android.app.Activity.performResume(Activity.java:8111)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4647)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4690) 
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:237) 
        at android.app.ActivityThread.main(ActivityThread.java:8167) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) ```
changxu0306 commented 3 years ago

Thank you for reporting this issue. From your code snippet, it seems that you are using our Amplify framework. I'll move your issue to our Amplify github repository.

yinzcam-android commented 3 years ago

Any update regarding the issue?

rjuliano commented 3 years ago

@yinzcam-android Would you be able to test this with the latest version of Amplify? The latest version of Amplify is 1.16.11 which uses version 2.22.1 of the low level SDK.

I haven't been able to reproduce the crash on logout using this sample code, but did run into a different issue unrelated to this.

Also, are you using an external Idp or logging in with users created in the user pool? I tested mine using google as an Idp. Going to try with user pool users now.

yinzcam-android commented 3 years ago

Hi Rafael,

Thanks fo the response, I'll try the newer sdk. In my latest testing I was using google to log in.

Warm Regards, Darshan

On Wed, Feb 3, 2021 at 9:30 AM Rafael Juliano notifications@github.com wrote:

@yinzcam-android https://github.com/yinzcam-android Would you be able to test this with the latest version of Amplify? The latest version of Amplify is 1.16.11 which uses version 2.22.1 of the low level SDK.

I haven't been able to reproduce the crash on logout using this sample code https://gist.github.com/rjuliano/b3410fcbadbc1d06a49af47bca9e7dfd, but did run into a different issue unrelated to this.

Also, are you using an external Idp or logging in with users created in the user pool? I tested mine using google as an Idp. Going to try with user pool users now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-android/issues/1090#issuecomment-772551974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZGIJUWUJRUYJLWCLZIY6LS5FM2DANCNFSM4VX4EMYA .

yinzcam-android commented 3 years ago

Hi Rafeal,

We are facing the same issue with the new sdk, we see that the logout success message is posted but still crashes, attached is the log for your reference:

Warm regards, Darshan

On Wed, Feb 3, 2021 at 10:14 AM YinzCam Android App < android.yinzcam@gmail.com> wrote:

Hi Rafael,

Thanks fo the response, I'll try the newer sdk. In my latest testing I was using google to log in.

Warm Regards, Darshan

On Wed, Feb 3, 2021 at 9:30 AM Rafael Juliano notifications@github.com wrote:

@yinzcam-android https://github.com/yinzcam-android Would you be able to test this with the latest version of Amplify? The latest version of Amplify is 1.16.11 which uses version 2.22.1 of the low level SDK.

I haven't been able to reproduce the crash on logout using this sample code https://gist.github.com/rjuliano/b3410fcbadbc1d06a49af47bca9e7dfd, but did run into a different issue unrelated to this.

Also, are you using an external Idp or logging in with users created in the user pool? I tested mine using google as an Idp. Going to try with user pool users now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-android/issues/1090#issuecomment-772551974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZGIJUWUJRUYJLWCLZIY6LS5FM2DANCNFSM4VX4EMYA .

2021-02-03 11:13:21.843 11386-13837/com.detroitlabs.cavaliers D/AWSCognito: Auth: log out successfully
2021-02-03 11:13:21.844 11386-11386/com.detroitlabs.cavaliers I/SurfaceView: onWindowVisibilityChanged(0) true android.widget.VideoView{963565e VFE...... ......I. 0,0-0,0 #7f0a1283 app:id/yinz_menu_activity_video_splash} of ViewRootImpl@6c1c680[ApplicationSettingsActivity]
2021-02-03 11:13:21.860 11386-11386/com.detroitlabs.cavaliers V/Lifecycle: OnPause() in YinzActivity
2021-02-03 11:13:21.860 11386-11386/com.detroitlabs.cavaliers D/Rover::: An Activity is pausing, flushing Rover Campaigns events queue.
2021-02-03 11:13:21.860 11386-11386/com.detroitlabs.cavaliers V/Analytics: Calling end page view
2021-02-03 11:13:21.860 11386-11386/com.detroitlabs.cavaliers V/Analytics: checking page view duraton for validity cur: 1612368801860 view:1612368790487 diff:11373
2021-02-03 11:13:21.860 11386-13456/com.detroitlabs.cavaliers V/Rover::EventQueueService: Skipping flush -- no events in the queue.
2021-02-03 11:13:21.861 11386-11386/com.detroitlabs.cavaliers V/CAVS: Registering action (SETTINGS) () (V) ()
2021-02-03 11:13:21.861 11386-11386/com.detroitlabs.cavaliers V/Analytics: getActionString returns:
2021-02-03 11:13:21.861 11386-11386/com.detroitlabs.cavaliers V/Analytics: <Action><Type><Major>V</Major><Minor></Minor></Type><InVenue>false</InVenue><SortOrder>4</SortOrder><SequenceNum>4</SequenceNum><Session>69a3f587-a6ae-4eac-a7da-bcff4b548901</Session><Resource><Major>SETTINGS</Major><Minor></Minor></Resource><DateTime><Request>2021-02-03T16:13:10Z</Request><Invisible>2021-02-03T16:13:21Z</Invisible></DateTime></Action>
2021-02-03 11:13:21.866 11386-11386/com.detroitlabs.cavaliers I/IntManager: onActivityPause
2021-02-03 11:13:21.866 11386-11386/com.detroitlabs.cavaliers I/IntManager: has  0 activity elements
2021-02-03 11:13:21.883 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.884 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.886 11386-11386/com.detroitlabs.cavaliers I/chatty: uid=10976(com.detroitlabs.cavaliers) identical 4 lines
2021-02-03 11:13:21.887 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.891 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.899 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: Relayout returned: old=(0,0,1080,2280) new=(0,0,1080,2280) req=(1080,2280)0 dur=7 res=0x1 s={true 538346733568} ch=false
2021-02-03 11:13:21.900 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.904 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.906 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.908 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.910 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.912 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.914 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.918 11386-11386/com.detroitlabs.cavaliers V/menu image: calling setSelectedItemState2
2021-02-03 11:13:21.928 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
2021-02-03 11:13:21.928 11386-11386/com.detroitlabs.cavaliers D/InputMethodManager: prepareNavigationBarInfo() DecorView@15e11f7[ApplicationSettingsActivity]
2021-02-03 11:13:21.928 11386-11386/com.detroitlabs.cavaliers D/InputMethodManager: getNavigationBarColor() -855310
2021-02-03 11:13:21.932 11386-11386/com.detroitlabs.cavaliers E/ViewRootImpl: sendUserActionEvent() mView returned.
2021-02-03 11:13:21.933 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
2021-02-03 11:13:21.989 11386-13315/com.detroitlabs.cavaliers W/tlabs.cavalier: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, linking, allowed)
2021-02-03 11:13:22.079 11386-11386/com.detroitlabs.cavaliers D/InputTransport: Input channel destroyed: 'ClientS', fd=143
2021-02-03 11:13:22.380 11386-11386/com.detroitlabs.cavaliers I/SurfaceView: onWindowVisibilityChanged(8) false android.widget.VideoView{963565e VFE...... ......I. 0,0-0,0 #7f0a1283 app:id/yinz_menu_activity_video_splash} of ViewRootImpl@6c1c680[ApplicationSettingsActivity]
2021-02-03 11:13:22.384 11386-13542/com.detroitlabs.cavaliers D/OpenGLRenderer: makeCurrent EglSurface : 0x7ec017b900 -> 0x0
2021-02-03 11:13:22.384 11386-13542/com.detroitlabs.cavaliers D/OpenGLRenderer: destroyEglSurface : 0x7ec017b900
2021-02-03 11:13:22.386 11386-13542/com.detroitlabs.cavaliers D/OpenGLRenderer: ~ReliableSurface : 0x7dbaf05d80
2021-02-03 11:13:22.393 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: Relayout returned: old=(0,0,1080,2280) new=(0,0,1080,2280) req=(1080,2280)8 dur=6 res=0x5 s={false 0} ch=true
2021-02-03 11:13:22.396 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: stopped(true) old=false
2021-02-03 11:13:22.397 11386-11386/com.detroitlabs.cavaliers I/SurfaceView: windowStopped(true) false android.widget.VideoView{963565e VFE...... ......I. 0,0-0,0 #7f0a1283 app:id/yinz_menu_activity_video_splash} of ViewRootImpl@6c1c680[ApplicationSettingsActivity]
2021-02-03 11:13:22.399 11386-11386/com.detroitlabs.cavaliers V/Lifecycle: OnStop() in YinzActivity
2021-02-03 11:13:22.400 11386-11386/com.detroitlabs.cavaliers I/IntManager: onActivityStop
2021-02-03 11:13:22.400 11386-11386/com.detroitlabs.cavaliers I/IntManager: has  0 activity elements
2021-02-03 11:13:22.402 11386-11386/com.detroitlabs.cavaliers I/IntManager: onActivitySaveState
2021-02-03 11:13:22.402 11386-11386/com.detroitlabs.cavaliers I/IntManager: has  0 activity elements
2021-02-03 11:13:22.418 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: Relayout returned: old=(0,0,1080,2280) new=(0,0,1080,2280) req=(1080,2280)8 dur=5 res=0x5 s={false 0} ch=false
2021-02-03 11:13:22.560 11386-11386/com.detroitlabs.cavaliers V/Rover::: App backgrounded, triggering event flush.
2021-02-03 11:13:22.561 11386-11386/com.detroitlabs.cavaliers V/Rover::SessionTracker: Leaving session ApplicationSession
2021-02-03 11:13:22.561 11386-13456/com.detroitlabs.cavaliers V/Rover::EventQueueService: Skipping flush -- no events in the queue.
2021-02-03 11:13:22.562 11386-11386/com.detroitlabs.cavaliers V/Rover::EventQueueService: Tracking event: Event(name=App Closed, attributes={}, timestamp=Wed Feb 03 11:13:22 EST 2021, id=f6550d90-a589-4e24-babd-2965203a89a1)
2021-02-03 11:13:22.563 11386-13456/com.detroitlabs.cavaliers V/Rover::EventQueueService: Capturing context...
2021-02-03 11:13:22.571 11386-13456/com.detroitlabs.cavaliers V/Rover::EventQueueService: Context is now: DeviceContext(appBuild=1676358, appIdentifier=com.detroitlabs.cavaliers, appVersion=3.5.8, carrierName=, deviceManufacturer=samsung, deviceModel=SM-N970U1, deviceIdentifier=f3b1fe4f-87ac-4c92-9a87-e3029001995b, deviceName=Galaxy Note10, isCellularEnabled=false, isLocationServicesEnabled=true, isWifiEnabled=true, locationAuthorization=authorizedWhenInUse, localeLanguage=en, localeRegion=US, localeScript=, isDarkModeEnabled=true, notificationAuthorization=Authorized, operatingSystemName=Android, operatingSystemVersion=10, pushEnvironment=null, pushToken=PushToken(value=cKE8HU9EdAw:APA91bEmdlgxke1AnlD3-8a5gqakbOK4Q7CZA05vi2G9S0r7nSZwzg-zSbSM7XotNilYGOBEFo3k0tcrRBN7LtR2vANeRRHt_1Fl-aO1lKn4i0oOT7xFEKpMY4d3_fYMhddCHejLEUup, timestamp=Fri Jan 22 11:19:27 EST 2021), radio=UNKNOWN: 0, screenWidth=411, screenHeight=834, sdkVersion=3.6.1, timeZone=America/New_York, isBluetoothEnabled=true, isTestDevice=false, location=Location(coordinate=Coordinate(latitude=40.4526989, longitude=-79.921911), altitude=268.0, verticalAccuracy=1.7084354162216187, horizontalAccuracy=11.550000190734863, timestamp=Fri Jan 22 11:19:43 EST 2021, address=Address(street=6221 Fifth Avenue, city=Pittsburgh, state=Pennsylvania, postalCode=15232, country=United States, isoCountryCode=US, subAdministrativeArea=Allegheny County, subLocality=null)), userInfo={tags=["NEWS","START_GAME","END_QUARTER","YC_TEST_4","YC_TEST_5"]}, advertisingIdentifier=null).
2021-02-03 11:13:22.571 11386-13456/com.detroitlabs.cavaliers V/Rover::EventQueueService: Skipping flush -- less than 20 events in the queue.
2021-02-03 11:13:22.949 11386-11386/com.detroitlabs.cavaliers V/Rover::GoogleBackgroundLocationService: Received location result: LocationResult[locations: [Location[fused 40.452704,-79.921895 hAcc=13 et=+2d2h7m39s714ms alt=268.1000061035156 vAcc=2 sAcc=??? bAcc=??? {Bundle[mParcelledData.dataSize=52]}]]]
2021-02-03 11:13:22.955 11386-11386/com.detroitlabs.cavaliers V/Rover::GoogleGeofenceService: Location update obtained so that distant geofences can be filtered out.
2021-02-03 11:13:22.955 11386-13633/com.detroitlabs.cavaliers V/Rover::GoogleGeofenceService: Determining 50 closest geofences for monitoring.
2021-02-03 11:13:22.995 11386-11386/com.detroitlabs.cavaliers V/Rover::GoogleGeofenceService: Got location permission, geofences, and current location.  Ready to start monitoring.
2021-02-03 11:13:22.995 11386-11386/com.detroitlabs.cavaliers V/Rover::GoogleGeofenceService: Updating geofences.
2021-02-03 11:13:22.999 11386-11386/com.detroitlabs.cavaliers V/Rover::GoogleGeofenceService: No removals from currently monitored geofences on Google needed.
2021-02-03 11:13:23.001 11386-11386/com.detroitlabs.cavaliers V/Rover::GoogleGeofenceService: No additions to currently monitored geofences on Google needed.
2021-02-03 11:13:23.003 11386-11386/com.detroitlabs.cavaliers W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@8e890a0
2021-02-03 11:13:23.029 11386-11386/com.detroitlabs.cavaliers D/PhoneWindow: forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4274 com.android.internal.policy.DecorView.updateColorViews:1547 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3252 android.view.Window.setFlags:1153 com.android.internal.policy.PhoneWindow.generateLayout:2474 
2021-02-03 11:13:23.030 11386-11386/com.detroitlabs.cavaliers I/MultiWindowDecorSupport: [INFO] isPopOver = false
2021-02-03 11:13:23.030 11386-11386/com.detroitlabs.cavaliers I/MultiWindowDecorSupport: updateCaptionType >> DecorView@bc7e8ff[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2021-02-03 11:13:23.030 11386-11386/com.detroitlabs.cavaliers D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@bc7e8ff[]
2021-02-03 11:13:23.040 11386-11386/com.detroitlabs.cavaliers W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@33c161b
2021-02-03 11:13:23.040 11386-11386/com.detroitlabs.cavaliers I/ViewRootImpl@6c1c680[ApplicationSettingsActivity]: stopped(false) old=true
2021-02-03 11:13:23.040 11386-11386/com.detroitlabs.cavaliers I/SurfaceView: windowStopped(false) false android.widget.VideoView{963565e VFE...... ......I. 0,0-0,0 #7f0a1283 app:id/yinz_menu_activity_video_splash} of ViewRootImpl@6c1c680[ApplicationSettingsActivity]
2021-02-03 11:13:23.044 11386-11386/com.detroitlabs.cavaliers V/Lifecycle: OnStart() in YinzActivity
2021-02-03 11:13:23.044 11386-11386/com.detroitlabs.cavaliers I/IntManager: onActivityStart
2021-02-03 11:13:23.044 11386-11386/com.detroitlabs.cavaliers I/IntManager: has  0 activity elements
2021-02-03 11:13:23.053 11386-11386/com.detroitlabs.cavaliers D/PhoneWindow: forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4274 com.android.internal.policy.DecorView.updateColorViews:1547 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3252 android.view.Window.setFlags:1153 com.android.internal.policy.PhoneWindow.generateLayout:2474 
2021-02-03 11:13:23.053 11386-11386/com.detroitlabs.cavaliers I/MultiWindowDecorSupport: [INFO] isPopOver = false
2021-02-03 11:13:23.053 11386-11386/com.detroitlabs.cavaliers I/MultiWindowDecorSupport: updateCaptionType >> DecorView@347c9cd[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2021-02-03 11:13:23.053 11386-11386/com.detroitlabs.cavaliers D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@347c9cd[]
2021-02-03 11:13:23.057 11386-11386/com.detroitlabs.cavaliers D/AndroidRuntime: Shutting down VM
    --------- beginning of crash
2021-02-03 11:13:23.058 11386-11386/com.detroitlabs.cavaliers E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.detroitlabs.cavaliers, PID: 11386
    java.lang.RuntimeException: Unable to resume activity {com.detroitlabs.cavaliers/com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsManagerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4657)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4690)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1713)
        at android.app.Activity.startActivityForResult(Activity.java:5258)
        at android.app.Activity.startActivityForResult(Activity.java:5203)
        at android.app.Activity.startActivity(Activity.java:5587)
        at android.app.Activity.startActivity(Activity.java:5555)
        at com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsManagerActivity.onResume(CustomTabsManagerActivity.java:68)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)
        at android.app.Activity.performResume(Activity.java:8111)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4647)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4690) 
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:237) 
        at android.app.ActivityThread.main(ActivityThread.java:8167) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) 
yinzcam-android commented 3 years ago

Looping in Conor.

On Wed, Feb 3, 2021 at 12:07 PM YinzCam Android App < android.yinzcam@gmail.com> wrote:

Hi Rafeal,

We are facing the same issue with the new sdk, we see that the logout success message is posted but still crashes, attached is the log for your reference:

Warm regards, Darshan

On Wed, Feb 3, 2021 at 10:14 AM YinzCam Android App < android.yinzcam@gmail.com> wrote:

Hi Rafael,

Thanks fo the response, I'll try the newer sdk. In my latest testing I was using google to log in.

Warm Regards, Darshan

On Wed, Feb 3, 2021 at 9:30 AM Rafael Juliano notifications@github.com wrote:

@yinzcam-android https://github.com/yinzcam-android Would you be able to test this with the latest version of Amplify? The latest version of Amplify is 1.16.11 which uses version 2.22.1 of the low level SDK.

I haven't been able to reproduce the crash on logout using this sample code https://gist.github.com/rjuliano/b3410fcbadbc1d06a49af47bca9e7dfd, but did run into a different issue unrelated to this.

Also, are you using an external Idp or logging in with users created in the user pool? I tested mine using google as an Idp. Going to try with user pool users now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-android/issues/1090#issuecomment-772551974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZGIJUWUJRUYJLWCLZIY6LS5FM2DANCNFSM4VX4EMYA .

rjuliano commented 3 years ago

I've tried a few different things to no avail. I ran the test APK on a Pixel 2 with Android 10 in DeviceFarm and was able to login and logout multiple times without experiencing a crash.

I did a bit of research based on the stack trace you posted. Found a post on stack overflow that may or may not be relevant in this case.

Does the device you're testing the on have Google Play Services enabled?

yinzcam-android commented 3 years ago

Hi Rafael,

We are seeing that crash consistently on our test device, yes the test devices have google play services enabled. Is it possible to handle the empty intent somewhere there? not sure about the complete flow but as per the logs there is a successful logout.

Devices used so far:

  1. Note 10, Android 10
  2. Note 5, Android 7.0
  3. Pixel 2, Android 10

Warm regards, Darshan

On Sat, Feb 6, 2021 at 3:38 PM Rafael Juliano notifications@github.com wrote:

I've tried a few different things to no avail. I ran the test APK on a Pixel 2 with Android 10 in DeviceFarm and was able to login and logout multiple times without experiencing a crash.

I did a bit of research based on the stack trace you posted. Found a post on stack overflow https://stackoverflow.com/questions/38041230/intent-migrateextrastreamtoclipdata-on-a-null-object-reference/46165052 that may or may not be relevant in this case.

Does the device you're testing the on have Google Play Services enabled?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-android/issues/1090#issuecomment-774540120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZGIJQM5PQ2OYVD7A5R4YDS5WSELANCNFSM4VX4EMYA .

rjuliano commented 3 years ago

I created a sample app that you can run against your backend. This will (hopefully) help narrow down the differences between your environment and mine. The app is pretty simple. It has an activity with a login and logout button and mimics the code you provided.

App repo: https://github.com/rjuliano/amplify-samples-android branch: amplify/auth-sample App dir: amplify-auth-app

All you need to do is drop your amplifyconfiguration.json file under amplify-auth-app/amplifyauthsample/src/main/res/raw. Then change the app_scheme string in amplify-auth-app/amplifyauthsample/src/main/res/values/strings.xml

Your app is obviously far more complex that this sample app, but as I said, maybe this will help us narrow down the source of the problem.

yinzcam-android commented 3 years ago

Hi Rafael,

I set up the sample app with the backend file and the redirect url, the sample app doesn't crash. Is there anything else which I can look at my end? I'm investigating but for some reason the customTabIntent is null on logout and it crashes.

Warm Regards, Darshan

On Wed, Feb 10, 2021 at 9:22 PM Rafael Juliano notifications@github.com wrote:

I created a sample app that you can run against your backend. This will (hopefully) help narrow down the differences between your environment and mine. The app is pretty simple. It has an activity with a login and logout button and mimics the code you provided.

App repo: https://github.com/rjuliano/amplify-samples-android branch: amplify/auth-sample App dir: amplify-auth-app

All you need to do is drop your amplifyconfiguration.json file under amplify-auth-app/amplifyauthsample/src/main/res/raw. Then change the app_scheme string in amplify-auth-app/amplifyauthsample/src/main/res/values/strings.xml

Your app is obviously far more complex that this sample app, but as I said, maybe this will help us narrow down the source of the problem.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-android/issues/1090#issuecomment-777166141, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZGIJS4YMH4OZ4UEO4V333S6M5QFANCNFSM4VX4EMYA .

yinzcam-android commented 3 years ago

Hi Rafael,

Just to add here, I attached the debugger for both the apps when I hit logout in the CustomTabsManagerActivity extractState() the state is null in case of sample app but it is not null in the main app, can you further investigate since this is something set with in the sdk?

Warm regards, Darshan

On Fri, Feb 12, 2021 at 3:23 PM YinzCam Android App < android.yinzcam@gmail.com> wrote:

Hi Rafael,

I set up the sample app with the backend file and the redirect url, the sample app doesn't crash. Is there anything else which I can look at my end? I'm investigating but for some reason the customTabIntent is null on logout and it crashes.

Warm Regards, Darshan

On Wed, Feb 10, 2021 at 9:22 PM Rafael Juliano notifications@github.com wrote:

I created a sample app that you can run against your backend. This will (hopefully) help narrow down the differences between your environment and mine. The app is pretty simple. It has an activity with a login and logout button and mimics the code you provided.

App repo: https://github.com/rjuliano/amplify-samples-android branch: amplify/auth-sample App dir: amplify-auth-app

All you need to do is drop your amplifyconfiguration.json file under amplify-auth-app/amplifyauthsample/src/main/res/raw. Then change the app_scheme string in amplify-auth-app/amplifyauthsample/src/main/res/values/strings.xml

Your app is obviously far more complex that this sample app, but as I said, maybe this will help us narrow down the source of the problem.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-android/issues/1090#issuecomment-777166141, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZGIJS4YMH4OZ4UEO4V333S6M5QFANCNFSM4VX4EMYA .

raphkim commented 3 years ago

This issue is now resolved with v1.17.8. Please follow the updated documentation to apply this fix :)

Mohammad-amleh commented 4 months ago

i countered this problem on v2.14.6 @raphkim @richardmcclellan any help ?