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

AndroidRuntime: FATAL EXCEPTION with android.test.canceled #177

Closed
martnst opened this issue Jun 3, 2018 · 5 comments
Closed

AndroidRuntime: FATAL EXCEPTION with android.test.canceled #177

martnst opened this issue Jun 3, 2018 · 5 comments
Labels
🤖 android Related to android

Comments

@martnst
Copy link

martnst commented Jun 3, 2018

Version of react-native-iap

1.0.6

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

no crash, instead fail gracefully

Actual behavior

crash in android native module

Tested environment (Emulator? Real Device?)

Device: Motoralo Moto G4

Steps to reproduce the behavior

Testing my app with test iap id android.test.canceled I get the following crash after android tells me the purchase was successful.

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.myapp.debug, PID: 15033
                  java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference
                      at com.dooboolab.RNIap.RNIapModule$7.onPurchasesUpdated(RNIapModule.java:379)
                      at com.android.billingclient.api.BillingClientImpl$1.onReceive(BillingClientImpl.java:136)
                      at com.android.billingclient.api.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:303)
                      at com.android.billingclient.api.LocalBroadcastManager.access$000(LocalBroadcastManager.java:44)
                      at com.android.billingclient.api.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:114)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6123)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Eventhough there might be actually sth. going wrong I would expect com.dooboolab.RNIap.RNIapModule to fail gracefully instead of crashing.

Thx

@martnst martnst changed the title AndroidRuntime: FATAL EXCEPTION AndroidRuntime: FATAL EXCEPTION with android.test.canceled Jun 3, 2018
@hyochan hyochan added the 🤖 android Related to android label Jun 4, 2018
@hyochan
Copy link
Owner

hyochan commented Jun 4, 2018

@martnst I haven't tried this one. I'll come back to you if I try this.

@yasheshkt
Copy link

yasheshkt commented Jun 7, 2018

Hi @dooboolab , Thanks a lot for this wonderful package. Initially I used 2 different packages for Android and IOS but now I use only yours. Saved so much of my time.

Even I am facing the same issue with android.test.canceled.
I was checking the logs and I saw something

06-07 11:42:15.720 4394 4394 W BillingHelper: Couldn't find purchase lists, trying to find single data. 06-07 11:42:15.721 4394 4394 W BillingHelper: Received a bad purchase data.

According to what I understand, I think the buy method is trying to load all already purchased products of the current account which leads to the crash? Correct me if I am totally wrong as I am not much into android native code, but the log messages gave me this first impression :)

@hyochan
Copy link
Owner

hyochan commented Jun 7, 2018

@martnst @yasheshkt Sorry for late come back guys. I was really busy these days. Could you please try 1.0.8? I've just tested this out and found out that purchases could be null when buyProduct. Please reopen when it is still crashing in 1.0.8. Thank you for the report!

@hyochan hyochan closed this as completed Jun 7, 2018
@martnst
Copy link
Author

martnst commented Jun 13, 2018

@dooboolab thanks for the quick fix. It working fine for me now.

@loopiezlol
Copy link
Contributor

experiencing the same problem now on version 2.3.23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android
Projects
None yet
Development

No branches or pull requests

4 participants