poiuytrez / AndroidInAppBilling

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

Crash in Base64.java. #88

Open agamemnus opened 9 years ago

agamemnus commented 9 years ago

Link to Base64.java here.

This is after a test order of "ad_removal_purchased". I got the screen, entered the password, and then it crashed. My server is not yet set up to ping Google Play with IAP verification and approvals but I don't think it went that far. It crashed when I did the order, and it is crashing on startup (the .refresh() call assume)

Edit: I found the reason. Somehow I still had $BILLING_KEY for my public key. $ wasn't valid so it crashed. I was using https://github.com/j3k0/cordova-plugin-purchase. I guess you made the Android code... maybe it can check for "$BILLING_KEY" on startup and send an error if that's the public key, or something... instead of crashing.

D/CordovaPurchase(30035): Num SKUs Found: 5
D/CordovaPurchase(30035): Product SKU Added: ad_removal_purchased
D/CordovaPurchase(30035): Product SKU Added: gems_9
D/CordovaPurchase(30035): Product SKU Added: gems_36
D/CordovaPurchase(30035): Product SKU Added: gems_54
D/CordovaPurchase(30035): Product SKU Added: gems_99
D/CordovaPurchase(30035): init start
D/CordovaPurchase(30035): Creating IAB helper.
D/CordovaPurchase(30035): Starting setup.
D/IabHelper(30035): Starting in-app billing setup.
D/IabHelper(30035): Billing service connected.
D/IabHelper(30035): Checking for in-app billing 3 support.
D/Finsky  (27447): [1216] InAppBillingUtils.pickAccount: myapp: Account determined from installer data - [jAQ9DvtEi_qPUJ2mLtdUcaxdnl0]
D/IabHelper(30035): In-app billing version 3 supported for myapp
D/Finsky  (27447): [1191] InAppBillingUtils.pickAccount: myapp: Account determined from installer data - [jAQ9DvtEi_qPUJ2mLtdUcaxdnl0]
D/IabHelper(30035): Subscriptions AVAILABLE.
D/CordovaPurchase(30035): Setup finished.
D/CordovaPurchase(30035): Setup successful. Querying inventory w/ SKUs.
D/IabHelper(30035): Starting async operation: refresh inventory
D/IabHelper(30035): Querying owned items, item type: inapp
D/IabHelper(30035): Package name: myapp
D/IabHelper(30035): Calling getPurchases with continuation token: null
D/Finsky  (27447): [1218] InAppBillingUtils.pickAccount: myapp: Account determined from installer data - [jAQ9DvtEi_qPUJ2mLtdUcaxdnl0]
D/IabHelper(30035): Owned items response: 0
E/IABUtil/Security(30035): Base64 decoding failed.
W/dalvikvm(30035): threadid=35: thread exiting with uncaught exception (group=0x419f3da0)
E/AndroidRuntime(30035): FATAL EXCEPTION: Thread-1339
E/AndroidRuntime(30035): Process: myapp, PID: 30035
E/AndroidRuntime(30035): java.lang.IllegalArgumentException: com.smartmobilesoftware.util.Base64DecoderException: Bad Base64 input character at 0: 36(decimal)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.Security.generatePublicKey(Security.java:70)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.Security.verifyPurchase(Security.java:47)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.IabHelper.queryPurchases(IabHelper.java:864)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.IabHelper.queryInventory(IabHelper.java:562)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.IabHelper.queryInventory(IabHelper.java:540)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.IabHelper$2.run(IabHelper.java:635)
E/AndroidRuntime(30035):        at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime(30035): Caused by: com.smartmobilesoftware.util.Base64DecoderException: Bad Base64 input character at 0: 36(decimal)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.Base64.decode(Base64.java:518)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.Base64.decode(Base64.java:446)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.Base64.decode(Base64.java:392)
E/AndroidRuntime(30035):        at com.smartmobilesoftware.util.Security.generatePublicKey(Security.java:60)
E/AndroidRuntime(30035):        ... 6 more
W/ActivityManager(  655):   Force finishing activity myapp/.MyApp
sebastianzillessen commented 9 years ago

Same here, using cordova CLI 4.1.2 and android 3.5.0. Any updates on this?

JuneTwooo commented 8 years ago

Where you found the $BILLING_KEY ? In my config -i use phonegap build), i have my own key, and that is

agamemnus commented 8 years ago

Everything probably changed now...

JuneTwooo commented 8 years ago

I solve the problem, this plugin doesnt work with phone gap build, i found another maintened