MinaSamir11 / react-native-in-app-review

The Google Play In-App Review API, App store rating API lets you prompt users to submit Play Store or App store ratings and reviews without the inconvenience of leaving your app or game.
MIT License
648 stars 58 forks source link

[CRASH][ANDROID] Fatal Exception: java.lang.NullPointerException #35

Closed kperreau closed 3 years ago

kperreau commented 3 years ago

Hello, new one on Android devices.

Android Version: 8, 9, 10

Devices: P20 lite, Galaxy S10e, Galaxy S8, Galaxy A51, Redmi Note 7

Error: Fatal Exception: java.lang.NullPointerException

Stack trace:

Fatal Exception: java.lang.NullPointerException
       at java.util.Objects.requireNonNull(Objects.java:203)
       at com.ibits.react_native_in_app_review.AppReviewModule.lambda$show$1(AppReviewModule.java:50)
       at com.ibits.react_native_in_app_review.-$$Lambda$AppReviewModule$bUmS5pB5E-8STvn0S-VVfLR6ozE.onComplete(-.java:4)
       at com.google.android.play.core.tasks.a.run(a.java:23)
       at android.os.Handler.handleCallback(Handler.java:907)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:216)
       at android.app.ActivityThread.main(ActivityThread.java:7625)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

Thanks.

MetinArslanturk commented 3 years ago

+1 i got the same error. Is getCurrentActivity() return null? If it does, weird. Anyway there should be a null check or try/catch to avoid crashing here a reference: https://github.com/lucasferreira/react-native-android-permissions/issues/3#issuecomment-223712114

Edit i opened a PR for null check. I used react native's offical example from here: https://reactnative.dev/docs/native-modules-android#getting-activity-result-from-startactivityforresult they made a if check for getCurrentActivity, too.

ogzhnsbs commented 3 years ago

+1 i got the same error. Is getCurrentActivity() return null? If it does, weird. Anyway there should be a null check or try/catch to avoid crashing here a reference: lucasferreira/react-native-android-permissions#3 (comment)

Edit i opened a PR for null check. I used react native's offical example from here: https://reactnative.dev/docs/native-modules-android#getting-activity-result-from-startactivityforresult they made a if check for getCurrentActivity, too.

+1

MinaSamir11 commented 3 years ago

May issue has been resolved in PR #36 and in version 3.1.1

@kperreau @ogzhnsbs Please Update package to version 3.1.1.

@MetinArslanturk Thanks for you effort.