Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-app-auth module getting crashed in Android #672

Closed
BajrangS opened this issue Sep 22, 2021 · 20 comments · Fixed by Nirodha26/react-native-app-auth#1
Closed

Comments

@BajrangS
Copy link

Issue

Firebase crashlytics report below crash issue in react-native app Android. There is no issues in iOS.

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference

com.rnappauth.RNAppAuthModule.onActivityResult (RNAppAuthModule.java:414)


Environment

  • Your Identity Provider: e.g. IdentityServer 4 / Okta / Azure
    Unable to identify because this is NPM module level crash

  • Platform that you're experiencing the issue on: iOS / Android / both
    Platform: Android

  • Are you using Expo?
    No

Please provide suggestions to fix this issue.

@ghost
Copy link

ghost commented Oct 11, 2021

Here's the crash log from my app


java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
    at com.rnappauth.RNAppAuthModule.onActivityResult(RNAppAuthModule.java:419)
    at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:305)
    at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:762)
    at com.facebook.react.ReactDelegate.onActivityResult(ReactDelegate.java:90)
    at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:112)
    at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:68)
    at android.app.Activity.dispatchActivityResult(Activity.java:8304)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:5006)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:5054)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7664)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=52, result=-1, data=Intent { dat=com.****.auth0://callback?code=**** (has extras) }} to activity {com.****/com.****.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
    at android.app.ActivityThread.deliverResults(ActivityThread.java:5013)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:5054)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7664)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    
    ```

@ghost
Copy link

ghost commented Oct 11, 2021

Same issue: #600

@mayzyo
Copy link

mayzyo commented Oct 26, 2021

This might be a different reason for crashing, but I was able to resolve my crash by adding in
dangerouslyAllowInsecureHttpRequests: true

I don't know how to check android's native log so I am not sure if its the same error. But in my research to resolve my issue, I ended up here and issue #600 a couple times, so I hope this can help anyone suffering from the same error.

@Jay-A-McBee
Copy link
Contributor

Jay-A-McBee commented Mar 25, 2022

This issue occurs on low-end Android devices that kill the Activity when your app is backgrounded during the authentication process. We persist values in private instance fields so we can read/use them during the code/token exchange in our onActivityResult handler. We end up getting a null pointer exception because these values don't exist when we go to read them. Notice the first line in the posted stack trace

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
    at com.rnappauth.RNAppAuthModule.onActivityResult(RNAppAuthModule.java:419)

I've talked with the other maintainers and we are going to try to get around to a fix for this. I can't provide a timeline, but just a heads up that it's on our radar. There are a few issues in the repo where this is the root cause.

@jmacpherson
Copy link

jmacpherson commented May 17, 2022

Also investigating this issue presently. Can't help but notice that while Nirodha26#1 put in what may be a fix for this issue in January, the releases since then have not included this update.

Edit: My mistake, I see that that is on a fork. Any chance of that getting merged into official?

@DennisOstertag
Copy link

Also investigating this issue presently. Can't help but notice that while Nirodha26#1 put in what may be a fix for this issue in January, the releases since then have not included this update.

Edit: My mistake, I see that that is on a fork. Any chance of that getting merged into official?

@Jay-A-McBee any chance this possible fix would resove the issue and can be merged here ?

@nachoperez714
Copy link

It would be great if this fix was merged into official and added in a next release.

@asami95
Copy link

asami95 commented Jul 5, 2022

Hello @Jay-A-McBee
It does not just happen in low-end devices it also happens in so many high-end ones.
Is there any chance to get the PR merged or solve this issue?

@sandergo90
Copy link

Is there any update about this issue @Jay-A-McBee ?

@asohail-futu
Copy link

Are there any plans of including this change Nirodha26#1 in an official release to fix this issue?

@kitingChris
Copy link

Will this issue be fixed soon or is the library not longer maintained?

@Cantinaband
Copy link

We are facing the same issue. Any updates?

@Crare
Copy link

Crare commented Nov 8, 2023

seeing similar errors in our App Center crash results:

com.rnappauth.RNAppAuthModule.onActivityResult
RNAppAuthModule.java, line 504
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference

main thread:

com.rnappauth.RNAppAuthModule.onActivityResult RNAppAuthModule.java:504
com.facebook.react.bridge.ReactContext.onActivityResult ReactContext.java:375
com.facebook.react.ReactInstanceManager.onActivityResult ReactInstanceManager.java:822
com.facebook.react.ReactDelegate.onActivityResult ReactDelegate.java:107
com.facebook.react.ReactActivityDelegate.onActivityResult ReactActivityDelegate.java:136
com.facebook.react.ReactActivity.onActivityResult ReactActivity.java:70
android.app.Activity.dispatchActivityResult Activity.java:8310
android.app.ActivityThread.deliverResults ActivityThread.java:5023
android.app.ActivityThread.handleSendResult ActivityThread.java:5071
android.app.servertransaction.ActivityResultItem.execute ActivityResultItem.java:51
android.app.servertransaction.TransactionExecutor.executeCallbacks TransactionExecutor.java:135
android.app.servertransaction.TransactionExecutor.execute TransactionExecutor.java:95
android.app.ActivityThread$H.handleMessage ActivityThread.java:2070
android.os.Handler.dispatchMessage Handler.java:106
android.os.Looper.loop Looper.java:223
android.app.ActivityThread.main ActivityThread.java:7711
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:592
com.android.internal.os.ZygoteInit.main ZygoteInit.java:952
android.app.ActivityThread.deliverResults ActivityThread.java:5030
android.app.ActivityThread.handleSendResult ActivityThread.java:5071
android.app.servertransaction.ActivityResultItem.execute ActivityResultItem.java:51
android.app.servertransaction.TransactionExecutor.executeCallbacks TransactionExecutor.java:135
android.app.servertransaction.TransactionExecutor.execute TransactionExecutor.java:95
android.app.ActivityThread$H.handleMessage ActivityThread.java:2070
android.os.Handler.dispatchMessage Handler.java:106
android.os.Looper.loop Looper.java:223
android.app.ActivityThread.main ActivityThread.java:7711
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:592
com.android.internal.os.ZygoteInit.main ZygoteInit.java:952

From devices like:

  • Nokia 1.3 Android 11
  • Galaxy A13 5G Android 13
  • Redmi Note 11 Android 11
  • HONOR 8S Android 9
  • Galaxy Tab A Android 11

We are using react-native-app-auth version 7.1.0, which is latest right now, but this has been happening for a while now.

We are also seeing some iOS errors too, but can't see any relation to this for now.

@fikkatra
Copy link

Same here, experiencing crashes on our production App. Mainly on HUAWEI P smart 2019, but others too, like Galaxy S21 5G and A52s 5G, Redmi Note 9 and 11 5G,...

More than 3 years since this issue was filed and still no fix, is this library still maintained actively?

@RubenPM-dev
Copy link
Contributor

Experiencing the same issue even on the latest devices like the Galaxy S24 Ultra, any help would be appreciated.

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=52, result=-1, data=Intent { dat=***app.auth://oauth/... (has extras) }} to activity {***app/***app.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:6062) at android.app.ActivityThread.handleSendResult(ActivityThread.java:6101) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67) at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8918) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

@nishadthajudeen001
Copy link

any update on this?

This happens on multiple production device( samsung q4q,OnePlus OnePlusN200TMO,motorola berlna,motorola denver etc)

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
at com.rnappauth.RNAppAuthModule.onActivityResult (RNAppAuthModule.java:492)
at com.facebook.react.bridge.ReactContext.onActivityResult (ReactContext.java:338)
at com.facebook.react.ReactInstanceManager.onActivityResult (ReactInstanceManager.java:824)

@carbonrobot
Copy link
Contributor

Hi everyone, we don't currently have any resources able to take on this work, but are happy to accept PRs from the community.

@RubenPM-dev
Copy link
Contributor

RubenPM-dev commented Feb 16, 2024

Hi everyone, we don't currently have any resources able to take on this work, but are happy to accept PRs from the community.

Thanks for all your work on this library, there are now a few PRs still open for a while. I have just submitted mine with the solution suggested by @yberstad which I can say it works on our end.

#564

@carbonrobot
Copy link
Contributor

@RubenPM-dev Thanks for the PR, we will review it as soon as possible.

@carbonrobot
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment