Android in Billing SecurityException "Enabling Binding in the Wrong Interface"

I am trying to get Google billing services to work.

I still have that the service is connected and connected, but as soon as I try to extract 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:

Activity showing Shopping:

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

The IAB calls once when 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); 

In the last line ...getSkuDetails(... it does not work with the error mentioned above.


I did some research on this and found that it could be caused by incorrect package names. I have included IInAppBillingService.aidl as described in the google documentation, but I still get the wrong package when importing:

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

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

 import billing.IInAppBillingService; 

According to the documentation, this should be:

 import com.android.vending.billing.IInAppBillingService; 

Is there something wrong with my project setup or does anyone know the reason for this error?

Thanks a lot in advance, MacFarlane

+8
android aidl in-app-billing securityexception
source share
3 answers

I had the same problem and I realized that the aidl file should be in the package com.android.vending.billing in the src folder, but you put this in src/main/aidl/com/android/vending/billing , which is wrong .

+19
source share

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

Copy the IInAppBillingService.aidl file into your project.

If you are using Android Studio, follow these steps to copy the file: Go to src / main in the project tool window. Choose File> New> Directory, enter Help in the New Directory window, and click OK. Choose File> New> Package, enter com.android.vending.billing in the New Package window, and click OK. Using the file system explorer of the operating system, go to <sdk> / extras / google / play_billing /, copy IInAppBillingService.aidl and paste it into com.android.vending.billing in your project.

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

enter image description here

0
source share

I had this problem due to the use of In App Billing v2 and I thought it was version v3. Unfortunately:)

0
source share

All Articles