L
Lerner
Guest
When I try to initialize In App Purchases with the function "iap_activate()", my game crashes ("Game X has stopped"). The IDE also logs lots of Java exceptions (please see below). I swear I have read all the available documentation, and I have searched for the same problem without success.
Here is my code:
Add a product to an existing "products" list (my function "iap_product_add(productId, title, description, price, someCallback)"):
// Store in a map
var productMap = ds_map_create()
ds_map_add(productMap, "id", product)
ds_map_add(productMap, "title", title)
ds_map_add(productMap, "description", description)
ds_map_add(productMap, "price", price)
// Fetch map to the list
ds_list_add(products, productMap)
ds_list_mark_as_map(products, ds_list_size(products) - 1)
Later in the same object, to initialize IAP:
iap_activate(products)
Log (from start of the "BILLING"):
6313 6313 I yoyo : BILLING: Loading services...
6313 6313 I yoyo : BILLING: Attempting to bind to Billing Service
6313 6313 I yoyo : BILLING: Service connected
6313 6313 I yoyo : BILLING: Billing v3 support available
6313 6313 I yoyo : BILLING: Request sku details
6313 6936 I yoyo : BILLING: getSkuDetails() at index 0
6313 6313 I yoyo : BILLING: Request purchase information
6313 6313 E yoyo : BILLING: Base64 decoding failed.
6313 6313 D AndroidRuntime: Shutting down VM
6313 6313 E AndroidRuntime: FATAL EXCEPTION: main
6313 6313 E AndroidRuntime: Process: com.dimitrilerner.tennislovr, PID: 6313
6313 6313 E AndroidRuntime: java.lang.IllegalArgumentException: android.Base64DecoderException: single trailing character at offset 32
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBillingSecurity.generatePublicKey(RunnerBillingSecurity.java:127)
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBillingSecurity.verifyPurchase(RunnerBillingSecurity.java:83)
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBilling$3$1.run(RunnerBilling.java:211)
6313 6313 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
6313 6313 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
6313 6313 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
6313 6313 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7325)
6313 6313 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
6313 6313 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
6313 6313 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
6313 6313 E AndroidRuntime: Caused by: android.Base64DecoderException: single trailing character at offset 32
6313 6313 E AndroidRuntime: at android.Base64.decode(Base64.java:559)
6313 6313 E AndroidRuntime: at android.Base64.decode(Base64.java:474)
6313 6313 E AndroidRuntime: at android.Base64.decode(Base64.java:420)
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBillingSecurity.generatePublicKey(RunnerBillingSecurity.java:114)
6313 6313 E AndroidRuntime: ... 9 more
6313 6355 I yoyo : Retrieving com.dimitrilerner.tennislovr.noads
6313 6355 I yoyo : Restoring com.dimitrilerner.tennislovr.noads to 0
6313 6355 I yoyo : BILLING: Request deferred, store isn't available right now
The GooglePlayServicesExtension is installed. Google Services are enabled, and the INTERNET permission too. No Google Licensing, no other permission. And I don't know if iOS is concerned too.
Also, first time I enabled an IAP, the app worked like a charm and I could test buy an item.
Please help me, what's wrong?
Edit: I didn't test activating Google Licensing. Is it mandatory?
Here is my code:
Add a product to an existing "products" list (my function "iap_product_add(productId, title, description, price, someCallback)"):
// Store in a map
var productMap = ds_map_create()
ds_map_add(productMap, "id", product)
ds_map_add(productMap, "title", title)
ds_map_add(productMap, "description", description)
ds_map_add(productMap, "price", price)
// Fetch map to the list
ds_list_add(products, productMap)
ds_list_mark_as_map(products, ds_list_size(products) - 1)
Later in the same object, to initialize IAP:
iap_activate(products)
Log (from start of the "BILLING"):
6313 6313 I yoyo : BILLING: Loading services...
6313 6313 I yoyo : BILLING: Attempting to bind to Billing Service
6313 6313 I yoyo : BILLING: Service connected
6313 6313 I yoyo : BILLING: Billing v3 support available
6313 6313 I yoyo : BILLING: Request sku details
6313 6936 I yoyo : BILLING: getSkuDetails() at index 0
6313 6313 I yoyo : BILLING: Request purchase information
6313 6313 E yoyo : BILLING: Base64 decoding failed.
6313 6313 D AndroidRuntime: Shutting down VM
6313 6313 E AndroidRuntime: FATAL EXCEPTION: main
6313 6313 E AndroidRuntime: Process: com.dimitrilerner.tennislovr, PID: 6313
6313 6313 E AndroidRuntime: java.lang.IllegalArgumentException: android.Base64DecoderException: single trailing character at offset 32
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBillingSecurity.generatePublicKey(RunnerBillingSecurity.java:127)
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBillingSecurity.verifyPurchase(RunnerBillingSecurity.java:83)
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBilling$3$1.run(RunnerBilling.java:211)
6313 6313 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
6313 6313 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
6313 6313 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
6313 6313 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7325)
6313 6313 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
6313 6313 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
6313 6313 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
6313 6313 E AndroidRuntime: Caused by: android.Base64DecoderException: single trailing character at offset 32
6313 6313 E AndroidRuntime: at android.Base64.decode(Base64.java:559)
6313 6313 E AndroidRuntime: at android.Base64.decode(Base64.java:474)
6313 6313 E AndroidRuntime: at android.Base64.decode(Base64.java:420)
6313 6313 E AndroidRuntime: at com.dimitrilerner.tennislovr.RunnerBillingSecurity.generatePublicKey(RunnerBillingSecurity.java:114)
6313 6313 E AndroidRuntime: ... 9 more
6313 6355 I yoyo : Retrieving com.dimitrilerner.tennislovr.noads
6313 6355 I yoyo : Restoring com.dimitrilerner.tennislovr.noads to 0
6313 6355 I yoyo : BILLING: Request deferred, store isn't available right now
The GooglePlayServicesExtension is installed. Google Services are enabled, and the INTERNET permission too. No Google Licensing, no other permission. And I don't know if iOS is concerned too.
Also, first time I enabled an IAP, the app worked like a charm and I could test buy an item.
Please help me, what's wrong?
Edit: I didn't test activating Google Licensing. Is it mandatory?
Last edited by a moderator: