distriqt / airnativeextensions

DEPRECATED: Original repository of the distriqt native extensions and is no longer maintained. Please see our site for the latest ANEs
https://airnativeextensions.com
2 stars 0 forks source link

Inappbilling fatal exception - android #235

Closed joshon closed 8 years ago

joshon commented 9 years ago

Hi,

I purchased a consumable item via a test user, (the app is in beta on Google Play) and now am in a state that whenever I open my app it crashes upon opening after I call InAppBilling.service.getProducts(). Here is the logcat:

D/com.distriqt.extension.inappbilling.util.IabHelper( 6363): Starting async operation: refresh inventory
D/com.distriqt.extension.inappbilling.util.IabHelper( 6363): Querying owned items, item type: inapp
D/com.distriqt.extension.inappbilling.util.IabHelper( 6363): Package name: air.org.domain.appname
D/com.distriqt.extension.inappbilling.util.IabHelper( 6363): Calling getPurchases with continuation token: null
I/air.org.domain.appname( 6363): InAppBilling.service.version: 2.6.Android.1.6
D/Finsky  ( 1533): [142] InAppBillingUtils.getPreferredAccount: air.org.domain.appname: Account from first account - [SYV...Yg]
D/com.distriqt.extension.inappbilling.util.IabHelper( 6363): Owned items response: 0
W/dalvikvm( 6363): threadid=22: thread exiting with uncaught exception (group=0x415caba8)
E/AndroidRuntime( 6363): FATAL EXCEPTION: Thread-300
E/AndroidRuntime( 6363): Process: air.org.domain.appname, PID: 6363
E/AndroidRuntime( 6363): java.lang.StringIndexOutOfBoundsException: length=11; regionStart=0; regionLength=12
E/AndroidRuntime( 6363):        at java.lang.String.startEndAndLength(String.java:588)
E/AndroidRuntime( 6363):        at java.lang.String.substring(String.java:1475)
E/AndroidRuntime( 6363):        at com.distriqt.extension.inappbilling.util.IabHelper.queryPurchases(IabHelper.java:869)
E/AndroidRuntime( 6363):        at com.distriqt.extension.inappbilling.util.IabHelper.queryInventory(IabHelper.java:544)
E/AndroidRuntime( 6363):        at com.distriqt.extension.inappbilling.util.IabHelper.queryInventory(IabHelper.java:522)
E/AndroidRuntime( 6363):        at com.distriqt.extension.inappbilling.util.IabHelper$2.run(IabHelper.java:617)
E/AndroidRuntime( 6363):        at java.lang.Thread.run(Thread.java:841)
W/ActivityManager(  483):   Force finishing activity air.org.domain.appname/.AppEntry

Is that familiar?

joshon commented 9 years ago

I have two android devices, unfortunately, on is my phone which uses my google dev. account, so I can't make purchases. On my Nexus 7, I get this error. I thought it might have something to do with the user state, so I cancelled all purchases, but the error persists. I get it when I use debug, and when I publish the release apk. I tried just requesting one product and it still produces this error. On my phone I can get the product info no problem, but can not make purchases etc.

joshon commented 9 years ago

After waiting, but without changing the app installed, the error stopped occurring. There is probably some state that the account can have that triggers this error. My guess is that it has something to do with consuming a product.

I sent a consumePurchase() from the purchase_successHandler on the purchase of a consumable product on Android. Is this how others do this? How do you detect whether you have an un-consumedPurchase and then consume it when starting up?

Nevertheless, this bug is concerning, it should not crash due to something being returned from the Google Play store.

joshon commented 9 years ago

I went back to testing. As soon as I tried to consumePurchase again - I got the same error. Do you have any advice?

joshon commented 9 years ago

Is there anything I can do to try and get this resolved? Is there other data that you would like to see?

marchbold commented 9 years ago

Hi, Sorry for the delay, we are busy with iOS 8 updates at the moment. I will try and get to this asap!

joshon commented 9 years ago

Ahh, thanks! No big rush for me. I just wanted to know that it had been seen. I'd like to work it out in the next week or so if possible.

Also, to be clear this is only a problem with consumePurchase() - if I don't try to consume a purchase it works just fine.

joshon commented 9 years ago

Is it possible to get an ETA on when you might get a chance to look at this? Thanks.