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.

Attempt to invoke interface method 'IInAppBillingService.getPurchases()' on a null object reference

See original GitHub issue

Version 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:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
eminsrcommented, Nov 6, 2018

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.

0reactions
hyochancommented, Dec 27, 2018

I will close this since this is related #315

Read more comments on GitHub >

github_iconTop 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 >

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