Home » Android » Android In App Billing SecurityException "Binder invocation to an incorrect interface"

Android In App Billing SecurityException "Binder invocation to an incorrect interface"

Posted by: admin June 15, 2020 Leave a comment


I am trying to get the google In App Billing services to work.

I’ve got so far that the service is bound and connected, but once I try to fetch some data from the service it crashes with the log:

04-02 10:36:32.795  10569-10651/my.app.package E/IAP﹕ java.lang.SecurityException: Binder invocation to an incorrect interface
            at android.os.Parcel.readException(Parcel.java:1425)
            at android.os.Parcel.readException(Parcel.java:1379)
            at billing.IInAppBillingService$Stub$Proxy.getSkuDetails(IInAppBillingService.java:251)
            at my.app.package.libs.clientbackend.iap.IAPHelper$FetchItemsCallable.call(IAPHelper.java:102)
            at my.app.package.libs.clientbackend.iap.IAPHelper$FetchItemsCallable.call(IAPHelper.java:89)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:856)

This is my code so far:

The activity that shows the Purchases:

Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
bindService(serviceIntent, this, Context.BIND_AUTO_CREATE);

The IAB calls once the service has connected:

Bundle itemBundle = new Bundle();
itemBundle.putStringArrayList("ITEM_ID_LIST", new ArrayList<>(Arrays.asList(itemIds)));
Bundle detailsBundle = service
        .getSkuDetails(3, context.getPackageName(), "inapp", itemBundle);

It fails on the last line ...getSkuDetails(... with the error posted above.

I did some research on this matter and found our that it might be caused by wrong package names. I’ve included the IInAppBillingService.aidl like it’s described on google’s documentation but I am still getting a wrong package on import:

The file is at: src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl

But when I am importing the generated class Android Studio uses this import path:

import billing.IInAppBillingService;

According to the documentation this should actually be:

import com.android.vending.billing.IInAppBillingService;

Is there still something wrong with my project setup or does anyone know the cause of this error?

Much thanks in advance,

How to&Answers:

I had the same problem and I figured out that aidl file must be in the com.android.vending.billing package in src folder but you put that in src/main/aidl/com/android/vending/billing which is not correct.


I also had the same problem. I follow this steps from https://developer.android.com

Copy the IInAppBillingService.aidl file to your project.

If you are using Android Studio, complete these steps to copy the
Navigate to src/main in the Project tool window.
Select File > New > Directory, enter aidl in the New Directory window, and select OK.
Select File > New > Package, enter com.android.vending.billing in the New Package window, and select OK.
Using your operating system file explorer, navigate to <sdk>/extras/google/play_billing/, copy the
IInAppBillingService.aidl file, and paste it into the
com.android.vending.billing package in your project.

I create aidl folder and then in this folder create package com.android.vending.billing, and my import is still import billing.IInAppBillingService; I try to add package in src but IInAppBillingService.java is not generated.

enter image description here


I had this problem due to using In App Billing v2 and thinking it was the v3 version. Oops 🙂