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.

queryPurchases NullPointerException

See original GitHub issue

Version of react-native-iap

4.4.0

Version of react-native

0.61.5

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

Android

Expected behavior

Doesn’t crash

Actual behavior

Crashes occasionally with
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'com.android.billingclient.api.Purchase$PurchasesResult com.android.billingclient.api.BillingClient.queryPurchases(java.lang.String)' on a null object reference
       at com.dooboolab.RNIap.RNIapModule$11.run(RNIapModule.java:575)
       at com.dooboolab.RNIap.RNIapModule.ensureConnection(RNIapModule.java:91)
       at com.dooboolab.RNIap.RNIapModule.sendUnconsumedPurchases(RNIapModule.java:569)
       at com.dooboolab.RNIap.RNIapModule.startListening(RNIapModule.java:596)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
       at android.os.Looper.loop(Looper.java:237)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
       at java.lang.Thread.run(Thread.java:919)

Tested environment (Emulator? Real Device?)

Real Device in production

Steps to reproduce the behavior

Unable to reproduce. We possibly require a null check for BillingClient before calling queryPurchases for the devices that have an issue with it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
medonagy45commented, May 24, 2021

I am having the same issue on version 5.2.13 here is the crash log

java.lang.NullPointerException: at com.dooboolab.RNIap.RNIapModule$13.run (RNIapModule.java:20) at com.dooboolab.RNIap.RNIapModule.ensureConnection (Unknown Source:10) at com.dooboolab.RNIap.RNIapModule.sendUnconsumedPurchases (Unknown Source:5) at com.dooboolab.RNIap.RNIapModule.startListening (Unknown Source) at java.lang.reflect.Method.invoke (Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke (Unknown Source:149) at com.facebook.react.bridge.JavaModuleWrapper.invoke (Unknown Source:21) at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method) at android.os.Handler.handleCallback (Handler.java:883) at android.os.Handler.dispatchMessage (Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (Unknown Source) at android.os.Looper.loop (Looper.java:237) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (Unknown Source:37) at java.lang.Thread.run (Thread.java:919)

0reactions
roots-aicommented, Aug 20, 2022

Any updates here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException in IabHelper.queryPurchases
NullPointerException : Attempt to invoke interface method 'android.os. ... queryPurchases(IabHelper.java:878) at com.myapp.utils.IabHelper.
Read more >
Google Play Billing Library 4 to 5 Migration Guide
This topic describes how to migrate from Google Play Billing Library 4 to Google Play Billing Library 5 and how to use new...
Read more >
marketbilling - Google Code
ID Status Summary 201 New Mac Wi‑Fi Type‑Defect Priority‑Medium 200 New 34:cd:be:a5:0f: Type‑Defect Priority‑Medium 197 New l Type‑Defect Priority‑Medium
Read more >
Android Question GooglePlayBilling - In App Purchases - B4X
NullPointerException : Attempt to invoke virtual method ... QueryPurchases("inapp")) Billing_PurchasesQueryCompleted (Result As BillingResult ...
Read more >
Example usage for android.os Bundle getStringArrayList - Java2s.com
int queryPurchases(Inventory inv, String itemType) throws JSONException, RemoteException, NullPointerException { // Query purchases logDebug("Querying owned ...
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