libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
224 stars 83 forks source link

NullPointerException on PurchaseManagerGoogleBilling (Android 5.1.1) #204

Closed florianbaethge closed 5 years ago

florianbaethge commented 5 years ago

Please ensure you have given all the following requested information in your report.

Issue details, reproduction steps/code

Crashlytics as well as the developer console currently show a NullPointerException within GdxPay.

The PurchaseManager is a private member in the AndroidLauncher class which is initialized in onCreate just before libgdx's initialize() method. It's not touched afterwards. The PurchaseObserver is created within the game's create() method, where the purchase manager is also directly being installed with the observer.

So far, the crash has only occured once and on a Samsung Galaxy J1 (2016) running Android 5.1.1

What reasons could there be for the observer being gone somehow? Should there maybe be a nullcheck within the android-googlebilling library?

Version of gdx-pay and/or relevant dependencies

0.12.1 for gdx-pay android and 1.0.0 core

Stacktrace

       at com.badlogic.gdx.pay.android.googlebilling.PurchaseManagerGoogleBilling.handlePurchase + 280(PurchaseManagerGoogleBilling.java:280)
       at com.badlogic.gdx.pay.android.googlebilling.PurchaseManagerGoogleBilling.access$700 + 42(PurchaseManagerGoogleBilling.java:42)
       at com.badlogic.gdx.pay.android.googlebilling.PurchaseManagerGoogleBilling$4.onPurchaseHistoryResponse + 208(PurchaseManagerGoogleBilling.java:208)
       at com.android.billingclient.api.BillingClientImpl$4$1.run + 493(BillingClientImpl.java:493)
       at android.os.Handler.handleCallback + 739(Handler.java:739)
       at android.os.Handler.dispatchMessage + 95(Handler.java:95)
       at android.os.Looper.loop + 145(Looper.java:145)
       at android.app.ActivityThread.main + 6917(ActivityThread.java:6917)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke + 372(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 1404(ZygoteInit.java:1404)
       at com.android.internal.os.ZygoteInit.main + 1199(ZygoteInit.java:1199)

Please select the affected platforms and payment service implementation

keesvandieren commented 5 years ago

Hi, you should not mix versions of different sub-components. Use version 1.0.0 for all components.

florianbaethge commented 5 years ago

Ohh ok thanks. I was just a bit confused because here it says the latest version for android-googlebilling is 0.12.1 https://search.maven.org/search?q=g:com.badlogicgames.gdxpay

I'll give that a try and check if the issue persists. Thank you

MrStahlfelge commented 5 years ago

Closing this, open again if the problem still persists.