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.

Buying `android.test.canceled` product crashes the app

See original GitHub issue

Version of react-native-iap

2.4.0-beta8

Version of react-native

0.55.4

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

Android

Expected behavior

Purchase promise is rejected with E_USER_CANCELLED, "Cancelled."

Actual behavior

App crashes:

01-28 11:21:58.177 2773-2919/ D/RNIapModule: buyItemByType (type: inapp, sku: android.test.canceled, oldSku: null, prorationMode: 0) responseCode: 0(OK)
01-28 11:22:03.509 2773-2919/ D/RNIapModule: Purchase Updated Listener
01-28 11:22:03.509 2773-2919/ D/RNIapModule: responseCode: 0
                                                                       
                                                                       --------- beginning of crash
01-28 11:22:03.510 2773-2919/ E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
                                                                          Process: , PID: 2773
                                                                          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$11.onPurchasesUpdated(RNIapModule.java:436)
                                                                              at com.android.billingclient.api.BillingClientImpl$1.onReceiveResult(BillingClientImpl.java:151)
                                                                              at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50)
                                                                              at android.os.Handler.handleCallback(Handler.java:789)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                              at android.os.Looper.loop(Looper.java:164)
                                                                              at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
                                                                              at java.lang.Thread.run(Thread.java:764)

Tested environment (Emulator? Real Device?)

Real device

Steps to reproduce the behavior

  • Purchase the Android static test product android.test.canceled
  • When onPurchasesUpdated is invoked, a NPE is thrown at line 436 Purchase purchase = purchases.get(0); because purchases is @Nullable and  null while responseCode is 0.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
hyochancommented, Jan 29, 2019

@johnmartel Yeah. I always wish to implement some test modules but currently, I am always running out of time 😿. We’ll have to check on runtime ourselves before releasing…

0reactions
stale[bot]commented, May 13, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community’s attention? This issue may be closed if no further activity occurs. You may also label this issue as “For Discussion” or “Good first issue” and I will leave it open. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In-App purchase crashing after payment - Stack Overflow
It's very hard to make it work since i can't test it personally and everytime i test it i lose money :( android....
Read more >
Problems with in-app purchases - Google Play Help
Troubleshoot the issue on your own · Check your connectivity · Force stop, then reopen the app or game · Check if your...
Read more >
App with in-app purchase crashes w… - Apple Developer
The funny thing is that I downloaded it and tried to purchase it for testing purposes and it crashes when the button that...
Read more >
Google fixes issue causing Android apps to crash ... - The Verge
Android apps were crashing for some users, but Google now has a fix. The issue is due to a system component called Android...
Read more >
Test your Google Play Billing Library integration
Ordinarily, the Google Play Billing Library is blocked for apps that aren't signed and uploaded to Google Play. License testers can bypass this ......
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