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.

BrowserAuthorizationFragment.createCustomTabResponseIntent crash NullPointerException

See original GitHub issue

Describe the bug My app is live and got this bug when use start sign in, the bug was reported in Firebase Crashlystic

Smartphone (please complete the following information):

  • Device: Xperia X
  • Android Version: 8.0.0
  • Browser: don’t know
  • MSAL Version: 1.4.0

Stacktrace

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
android.content.ComponentName.<init> (ComponentName.java:131)
android.content.Intent.<init> (Intent.java:5698)
com.microsoft.identity.common.internal.providers.oauth2.BrowserAuthorizationFragment.createCustomTabResponseIntent (BrowserAuthorizationFragment.java:77)
com.microsoft.identity.client.BrowserTabActivity.onCreate (BrowserTabActivity.java:64)
android.app.Activity.performCreate (Activity.java:6975)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1214)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2778)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2900)
android.app.ActivityThread.-wrap11 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1601)
android.os.Handler.dispatchMessage (Handler.java:105)
android.os.Looper.loop (Looper.java:251)
android.app.ActivityThread.main (ActivityThread.java:6589)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)

To Reproduce

  • Start user authentication screen

Expected behavior User can signed in

Actual Behavior Crash because of this error

Additional context This bug is a random crash. Not all users have it. I checked the code where it crashes, the sCallingActivityClass static field was null that was used before it is set by BrowserAuthorizationFragment.createCustomTabResponseIntent(..)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pomian17commented, May 8, 2020

@shahzaibj, we are also facing this bug. There are some devices (e.g. Xiaomi Mi A2 lite, Huawei P10 lite, LG K4, Polaroid Snap S60, LG X power) that this happens on (no specific Android version, seems to happen on all of them) Scenario is as follows:

  1. Open Login/forgot/password/register page (in BrowserAuthorizationFragment)
  2. Activity gets killed by system, only browser window remains.
  3. Fill in the forms. Click e.g. login to return to app.
  4. Activity is recreated, but it has no preserved state, so before app crashed due to NullPointerException, now it shows toast, but it does not change the fact, that user is not able to be authorized.

It does not happens always, but usually there has to be about 3-4 bug occurences until user is able to proceed. Maybe there is a way to make this activity able to survive process death?

Also, changing authorization_user_agent setting to WEBVIEW helps, as mentioned in https://github.com/AzureAD/microsoft-authentication-library-for-android/issues/923, but we still have problem in register form, where after clicking privacy policy link, and coming back, activity is restarted. User cannot also change app to other during this process. For example to get code that was sent to email and has to be provided in app. After coming back, registration process is restarted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Major NullPointerException crash surfacing - Stack Overflow
I am facing the same issue almost across all my Apps. Admob version 20.5. regardless of SDK target the crash is gaining momentum....
Read more >
Crash in java.lang.NullPointerException: at android.view.View ...
I can reproduce this on a Pixel 3 XL by locking the device with Firefox up, waking the device by bringing up the...
Read more >
Bug: Application crashes due to NullpointerException while ...
This is the issue tracker for the Google Maps API, not the Google Maps Android application. Please send feedback through the built-in 'send...
Read more >
How to fix Common Crashes, NullPointerException ... - YouTube
... on the stream about how to solve App crashes, and I decided to demonstrate how to solve a common error like a...
Read more >
java.lang.NullPointerException: , crash in Android IMA sdk ...
Crash Log : Android 4.4, 5.0, 5.1, 6.0, 9.0. java.lang.NullPointerException: at com.google.ads.interactivemedia.v3.impl.data.y.create (y.java:32).
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