poiuytrez / AndroidInAppBilling

Android App Billing plugin for Cordova
173 stars 144 forks source link

Getting error "IAB helper is not set up." #50

Closed mattgrande closed 5 years ago

mattgrande commented 10 years ago

So, I'm confused... I've followed the example, and traced through the code, and the IabHelper is being successfully set up... then when it tries to query the inventory, I get an error saying "In-app billing error: Illegal state for operation (queryInventoryAsync): IAB helper is not set up."

The logs indicate that the setup is being completed successfully, however the queryInventoryAsync call fails every time.

I have no idea where to go from here, any help would be appreciated. I tried removing the "setup" check, but that didn't help...

Here's my logs:

05-26 09:35:22.999: I/chromium(11581): [INFO:CONSOLE(6)] "InAppBilling[js]: setup ok", source: file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js (6)
05-26 09:35:22.999: D/CORDOVA_BILLING(11581): init start
05-26 09:35:22.999: D/CORDOVA_BILLING(11581): Creating IAB helper.
05-26 09:35:22.999: D/CORDOVA_BILLING(11581): Starting setup.
05-26 09:35:22.999: D/IabHelper(11581): Starting in-app billing setup.
05-26 09:35:23.049: D/IabHelper(11581): Billing service connected.
05-26 09:35:23.049: D/IabHelper(11581): Checking for in-app billing 3 support.
05-26 09:35:23.110: D/Finsky(16254): [21643] InAppBillingUtils.pickAccount: com.weever.streetsmarts: Account determined from installer data - [u2B8B-eCVRdcCYh9DaSZlzqpMcA]
05-26 09:35:23.110: D/IabHelper(11581): In-app billing version 3 supported for com.weever.streetsmarts
05-26 09:35:23.110: D/Finsky(16254): [21610] InAppBillingUtils.pickAccount: com.weever.streetsmarts: Account determined from installer data - [u2B8B-eCVRdcCYh9DaSZlzqpMcA]
05-26 09:35:23.110: D/IabHelper(11581): Subscriptions AVAILABLE.
05-26 09:35:23.110: D/IabHelper(11581): Everything set up sucessfully!
05-26 09:35:23.110: D/CORDOVA_BILLING(11581): Setup finished.
05-26 09:35:23.110: D/CORDOVA_BILLING(11581): Setup successful. Querying inventory.
05-26 09:35:23.110: E/IabHelper(11581): In-app billing error: Illegal state for operation (queryInventoryAsync): IAB helper is not set up.
05-26 09:35:23.120: D/AndroidRuntime(11581): Shutting down VM
05-26 09:35:23.120: W/dalvikvm(11581): threadid=1: thread exiting with uncaught exception (group=0x418abda0)
05-26 09:35:23.120: E/AndroidRuntime(11581): FATAL EXCEPTION: main
05-26 09:35:23.120: E/AndroidRuntime(11581): Process: com.weever.streetsmarts, PID: 11581
05-26 09:35:23.120: E/AndroidRuntime(11581): java.lang.IllegalStateException: IAB helper is not set up. Can't perform operation: queryInventoryAsync
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.smartmobilesoftware.util.IabHelper.checkSetupDone(IabHelper.java:784)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.smartmobilesoftware.util.IabHelper.queryInventoryAsync(IabHelper.java:612)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.smartmobilesoftware.util.IabHelper.queryInventoryAsync(IabHelper.java:641)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.smartmobilesoftware.inappbilling.InAppBillingPlugin$1.onIabSetupFinished(InAppBillingPlugin.java:166)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.smartmobilesoftware.util.IabHelper$1.onServiceConnected(IabHelper.java:262)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1119)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1136)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at android.os.Handler.handleCallback(Handler.java:733)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at android.os.Handler.dispatchMessage(Handler.java:95)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at android.os.Looper.loop(Looper.java:157)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at android.app.ActivityThread.main(ActivityThread.java:5356)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at java.lang.reflect.Method.invokeNative(Native Method)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at java.lang.reflect.Method.invoke(Method.java:515)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
05-26 09:35:23.120: E/AndroidRuntime(11581):    at dalvik.system.NativeStart.main(Native Method)
05-26 09:35:23.120: W/ActivityManager(869):   Force finishing activity com.weever.streetsmarts/.StreetSmarts
dshuang commented 10 years ago

I have gotten an "IAB helper not available" message before when the account used to test the app is not on the list of testers.

Please make sure to upload and publish your apk to the alpha or beta channels and that the test account is in the google+ community that was granted access to testing. With the test account, follow the url that appears in the alpha or beta channels after the apk is published and make sure to accept the test invitation.

If you just published your apk in the alpha or beta channels, you may need to wait a few hours before the url works.

vundurty commented 7 years ago

Hi, Even I'm receiving same error

java.lang.IllegalStateException: IAB helper is not set up. Can't perform operation: queryInventory at com.smartmobilesoftware.util.IabHelper.checkSetupDone(IabHelper.java:784) at com.smartmobilesoftware.util.IabHelper.queryInventoryAsync(IabHelper.java:612) at com.smartmobilesoftware.util.IabHelper.queryInventoryAsync(IabHelper.java:641) at jp.wizcorp.phonegap.plugin.wizPurchase.IAP$2.onIabSetupFinished(IAP.java:285) at com.smartmobilesoftware.util.IabHelper$1.onServiceConnected(IabHelper.java:260)

Can anyone help me solve this?