TheCodez / Google-IAP-Library

Automatically exported from code.google.com/p/marketbilling
0 stars 0 forks source link

launchPurchaseFlow() does not call flagEndAsync() when there are no exceptions #193

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
STEPS TO REPRODUCE:
1. Buy an item with in-app billing
2. You get a message telling you whether the purchase went ok or not.
3. Attempt to buy something else.

EXPECTED OUTPUT:
You should get another message telling you whether the purchase went ok or not.

ACTUAL OUTPUT:
The app crashes.

AFFECTED ORDER IDS (IF RELEVANT):
Not relevant

OS VERSION:
Android 4.4.4

MARKET/MYAPPS VERSION:
v3

DEVICE:
Nexus 5

OUTPUT FROM ADB BUGREPORT ATTACHED:
(Note: The output from "adb bugreport" is required for all bug reports.)

### HERE I TRY TO PURCHASE FOR THE FIRST TIME, IT ENDS WITH MESSAGE "THE ITEM 
COULD NOT BE FOUND" ONSCREEN, BUT THIS IS NOT VISIBLE IN THE LOG

08-01 22:20:12.551  11180-11180/no.bjarte.telefonterror.android.free.beta.debug 
D/TrivialDrive﹕ Upgrade button clicked; launching purchase flow for upgrade.
08-01 22:20:12.551  11180-11180/no.bjarte.telefonterror.android.free.beta.debug 
D/IabHelper﹕ Starting async operation: launchPurchaseFlow
08-01 22:20:12.551  11180-11180/no.bjarte.telefonterror.android.free.beta.debug 
D/IabHelper﹕ Constructing buy intent for purchased_remove_ads, item type: 
inapp
08-01 22:20:12.551  11180-11180/no.bjarte.telefonterror.android.free.beta.debug 
D/IabHelper﹕ Launching buy intent for purchased_remove_ads. Request code: 
10001

### HERE I TRY TO PURCHASE A SECOND TIME, THIS TIME THE APP CRASHES BECAUSE THE 
FIRST ATTEMPT IS NEVER PROPERLY FINISHED

08-01 22:20:28.771  11180-11180/no.bjarte.telefonterror.android.free.beta.debug 
D/TrivialDrive﹕ Upgrade button clicked; launching purchase flow for upgrade.
08-01 22:20:28.771  11180-11180/no.bjarte.telefonterror.android.free.beta.debug 
E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: no.bjarte.telefonterror.android.free.beta.debug, PID: 11180
    java.lang.IllegalStateException: Can't start async operation (launchPurchaseFlow) because another async operation(launchPurchaseFlow) is in progress.
            at iab.IabHelper.flagStartAsync(IabHelper.java:819)
            at iab.IabHelper.launchPurchaseFlow(IabHelper.java:373)
            at iab.IabHelper.launchPurchaseFlow(IabHelper.java:338)
            at view.PurchaseFragment.onUpgradeAppButtonClicked(PurchaseFragment.java:159)
            at view.PurchaseFragment$2.onClick(PurchaseFragment.java:104)
            at android.view.View.performClick(View.java:4438)
            at android.view.View$PerformClick.run(View.java:18422)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

NOTES:

There must be something missing on line 381-389 in IabHelper.java, because if 
you don't get any exceptions when running launchPurchaseFlow(), flagEndAsync() 
is never called, and then you get the above error when you are trying to do 
another async call.

Original issue reported on code.google.com by bja...@basementmedia.no on 1 Aug 2014 at 8:41