Attempt to invoke interface method 'IInAppBillingService.getPurchases()' on a null object reference
See original GitHub issueVersion of react-native-iap
“react-native-iap”: “^2.3.17”
Platforms you faced the error (IOS or Android or both?)
Android
Expected behavior
it should check if mService
is null before calling getPurchases()
Actual behavior
It doesn’t check if mService
is null and throws this error
Attempt to invoke interface method 'android.os.Bundle com.android.vending.billing.IInAppBillingService.getPurchases(int, java.lang.String, java.lang.String, java.lang.String)' on a null object reference
Tested environment (Emulator? Real Device?)
Real Device Android 6.0
Steps to reproduce the behavior
Just call RNIap.getAvailablePurchases() after initConnection(),
const result = await RNIap.initConnection();
const purchases = await RNIap.getAvailablePurchases();
I temporarily fix it by setting a timeout for getAvailablePurchases()
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Attempt to invoke interface method 'android ... - Stack Overflow
Initialize in-app billing service at the app startup, and check mService for null after calling tryToPurchase().
Read more >3245632 - Error in Mobile SDK 'Fatal Exception: java.lang ...
NullPointerException: Attempt to invoke interface method 'boolean java.util.Map.containsKey(java.lang.Object)' on a null object reference ・Question 1.
Read more >[Android] NullPointerException at QtInAppPurchase.java:240 ...
NullPointerException: Attempt to invoke interface method ... getPurchases(int, java.lang. ... String)' on a null object reference at ...
Read more >Issue #1516: IInAppBillingService - Crash reported in Google ...
String)' on a null object reference. Code: [Select]. java.lang.NullPointerException: Attempt to invoke interface method 'android.os.
Read more >Attempt to invoke interface method 'void com.google.android ...
java.lang.NullPointerException: Attempt to invoke interface method 'void com.google.android.gms.ads.internal.webview.i.d()' on a null object reference.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I tried a couple of times, adding if statement seems like fixed it. I didn’t understand why though it always returns the same thing. Anyway, thanks.
I will close this since this is related #315