Android Question java.lang.NullPointerException when trying to initialize In-App billing

trueboss323

Active Member
Licensed User
Longtime User
Hello all,
I get this following error when I try to initialize my In-App billing manager.

B4X:
 bmanager.Initialize("bmanager", key)





java.lang.NullPointerException
at anywheresoftware.b4a.objects.IbHelper.startSetup(IbHelper.java:269)
at anywheresoftware.b4a.inappbilling3.BillingManager3.Initialize(BillingManager3.java:44)
at com.calculator.main._activity_create(main.java:741)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at com.calculator.main.afterFirstLayout(main.java:100)
at com.calculator.main.access$100(main.java:17)
at com.calculator.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)


at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)


What can the problem be?
 

DonManfred

Expert
Licensed User
Longtime User
Make sure you have the most up to date version of the library (1.11 afaik)
https://www.b4x.com/android/forum/threads/in-app-billing-v3-library.29998/#post174139

Also make sure you have the newest inapp billing lib from google in the sdk
playbilling.png


Where do you do the call of
B4X:
bmanager.Initialize("bmanager", key)
In which sub?
 
Upvote 0

trueboss323

Active Member
Licensed User
Longtime User
I think I figured out the problem,

I was testing this on an emulator, so Google Play services was not available. But I tested it on a real device and it works fine.

I do the calling in the sub Sub Activity_Create(FirstTime As Boolean)

In this case, I have another question: How can i detect if Google Play is installed on the device, that way it disables all in-app purchasing features.
 
Upvote 0
Top