question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE on AuthorizationManagementActivity.onResume (from Android framework?)

See original GitHub issue

I can’t reproduce it myself, but on an app with around half million active users it’s happening on production from time to time. (we are using the latest AppAuth version 0.7.0).

Usually happening on these devices:

  • Huawei 荣耀5X (HNKIW-Q) [Android 6.0]
  • Galaxy TabS 10.5 (chagalllte) [Android 6.0]
  • Gigaset GS170 (GS170) [Android 7.0]
  • Galaxy J1 (j13g) [Android 4.4]
  • Samsung Galaxy S5 mini (kminilte) [Android 6.0]

NPE:

java.lang.NullPointerException: android.app.Instrumentation in Attempt to invoke virtual method ‘boolean android.content.Intent.migrateExtraStreamToClipData()’ on a null object reference.execStartActivity

Stack trace:

at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4225)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
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:1534)
at android.app.Activity.startActivityForResult(Activity.java:4298)
at android.app.Activity.startActivityForResult(Activity.java:4245)
at android.app.Activity.startActivity(Activity.java:4582)
at android.app.Activity.startActivity(Activity.java:4550)
at net.openid.appauth.AuthorizationManagementActivity.onResume(AuthorizationManagementActivity.java)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1287)
at android.app.Activity.performResume(Activity.java:7015)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4214)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
richardn100commented, Aug 2, 2018

Hi, I believe I found the cause for this crash:

It occurs when you open the authorization request twice in a row (e.g. double-clicking your app’s login button which calls the AppAuth SDK twice via “performAuthorizationRequest” or “getAuthorizationRequestIntent”). The crash occurs after completing the login process and it tries to return back to your app.

I am temporarily fixing this issue by adding a boolean in my app to determine if the authorization is occurring already.

3reactions
zoltanfcommented, Mar 9, 2018

Our tester has managed to reproduce this problem. This happens if the user interrupts the flow, by following steps:

  • Initiates the sign-in
  • In web view, clicks the 3 dots menu, open in chrome
  • Goes back to the app, so the auth flow is interrupted
  • At some point later goes to chrome, finishes the sign-in process and then when the app get’s a callback, the app crashes.

Stacktrace from our reproduction:

Android: 8.1.0
Android Build: OPP6.171019.012
Manufacturer: LGE
Model: Nexus 5X
Thread: main-2
CrashReporter Key: 178ec6e2-b9b0-428d-908f-bbc7e8bc8f7b
Start Date: 2018-03-09T15:12:31.570Z
Date: 2018-03-09T15:21:13.380Z

java.lang.RuntimeException: Unable to resume activity {com.marktguru.android.beta/net.openid.appauth.AuthorizationManagementActivity}: 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:3581)
	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
	at android.app.ActivityThread.-wrap11(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6494)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
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:1609)
	at android.app.Activity.startActivityForResult(Activity.java:4487)
	at android.app.Activity.startActivityForResult(Activity.java:4445)
	at android.app.Activity.startActivity(Activity.java:4806)
	at android.app.Activity.startActivity(Activity.java:4774)
	at net.openid.appauth.AuthorizationManagementActivity.onResume(AuthorizationManagementActivity.java:218)
	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355)
	at android.app.Activity.performResume(Activity.java:7107)
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
	... 10 more
Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NullPointerException on onResume() - Stack Overflow
Inside the run method you have: InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);.
Read more >
NullPointerException - Android Developers
On this page; Summary. Public constructors; Inherited methods. Public constructors. NullPointerException; NullPointerException. Android Developers.
Read more >
Activity.OnResume Method (Android.App) | Microsoft Learn
This topic introduces these frameworks and discusses how to create custom graphics and animations for use in a Xamarin.Android application. Layouts - Xamarin....
Read more >
Bug: NullPointerException: Resources.getConfiguration ...
NullPointerException : Attempt to invoke virtual method 'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object ...
Read more >
Fix "java.lang.NullPointerException" in Android Studio
Null Pointer Exception in Android Studio. NullPointerException in Android Studio highlighted in yellow color in the below screenshot. As you can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found