Exception after pruchase with IAP 2.4.1.1

I’m having and exception just after purchase with version 2.4.1.1, I was using 2.4.0.2 without problem.

If helps, I’ve tried to trace code and exception is on Base64.class function:

public static byte[] decode(String s) throws Base64DecoderException

‘s’ string value is ‘com.test.test’

Here is the exception:

2018-11-01 16:49:56.356 2451-2451/com.eaappentertainment.bellyrun E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.eaappentertainment.bellyrun, PID: 2451
java.lang.IllegalArgumentException: com.sdkbox.plugin.Base64DecoderException: Bad Base64 input character at 3: 46(decimal)
at com.sdkbox.plugin.Security.generatePublicKey(Security.java:127)
at com.sdkbox.plugin.Security.localVerify(Security.java:133)
at com.sdkbox.plugin.Security.verifyPurchase(Security.java:103)
at com.sdkbox.plugin.SDKBoxIABBillingClient.purchaseVerifiAndNotify(SDKBoxIABBillingClient.java:480)
at com.sdkbox.plugin.SDKBoxIABBillingClient.handlePurchaseResult(SDKBoxIABBillingClient.java:403)
at com.sdkbox.plugin.SDKBoxIABBillingClient.onPurchasesUpdated(SDKBoxIABBillingClient.java:554)
at com.android.billingclient.api.BillingClientImpl$1.onReceive(BillingClientImpl.java:136)
at com.android.billingclient.api.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:303)
at com.android.billingclient.api.LocalBroadcastManager.access$000(LocalBroadcastManager.java:44)
at com.android.billingclient.api.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:114)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: com.sdkbox.plugin.Base64DecoderException: Bad Base64 input character at 3: 46(decimal)
at com.sdkbox.plugin.Base64.decode(Base64.java:546)
at com.sdkbox.plugin.Base64.decode(Base64.java:474)
at com.sdkbox.plugin.Base64.decode(Base64.java:420)
at com.sdkbox.plugin.Security.generatePublicKey(Security.java:117)
at com.sdkbox.plugin.Security.localVerify(Security.java:133)
at com.sdkbox.plugin.Security.verifyPurchase(Security.java:103)
at com.sdkbox.plugin.SDKBoxIABBillingClient.purchaseVerifiAndNotify(SDKBoxIABBillingClient.java:480)
at com.sdkbox.plugin.SDKBoxIABBillingClient.handlePurchaseResult(SDKBoxIABBillingClient.java:403)
at com.sdkbox.plugin.SDKBoxIABBillingClient.onPurchasesUpdated(SDKBoxIABBillingClient.java:554)
at com.android.billingclient.api.BillingClientImpl$1.onReceive(BillingClientImpl.java:136)
at com.android.billingclient.api.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:303)
at com.android.billingclient.api.LocalBroadcastManager.access$000(LocalBroadcastManager.java:44)
at com.android.billingclient.api.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:114)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

please check your sdkbox_config.json,

{
    "android": {
        "iap": {
            ...

            "key": "MIIBIjANBgkqhkiG...."
        }
    },

   ...
}

you should fill key with google iap public key, not ‘com.test.test’

if you want to verify iap purchase by your self, you can remove the key.

Thanks a lot htlxyz, I was crazy with this thing.

Why did not crash with 2.4.0.2 ? Billing verification was not implemented there?

Please update Docs so developers can find this faster. It took me a bit to find where the key is. For the record:

In Google Console->Developer Tools->Services & APIs

Again thanks a lot, I’m going to try it now.

  1. document about the key
    ok, we will update docs

  2. the Base64 class is not change between 2.4.1.1 and 2.4.0.2, and the the decode function need a base64 string, 2.4.0.2 should throw Base64DecoderException, we will look into this later.

Didn’t crash on 2.4.0.2. Started to crash when upgraded.

Thanks a lot!