Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova-plugin-inapppurchase error: package com.android.vending.billing does not exist

After adding the cordova-plugin-inapppurchase to my project, building web assets for android platform fails:

<project_folder>\platforms\android\app\src\main\java\com\alexdisler\inapppurchases\IabHelper.java:33: error: package com.android.vending.billing does not exist
import com.android.vending.billing.IInAppBillingService;
                                  ^
<project_folder>\platforms\android\app\src\main\java\com\alexdisler\inapppurchases\IabHelper.java:103: error: cannot find symbol
    IInAppBillingService mService;
    ^
  symbol:   class IInAppBillingService
  location: class IabHelper
<project_folder>\platforms\android\app\src\main\java\com\alexdisler\inapppurchases\IabHelper.java:230: error: package IInAppBillingService does not exist

                mService = IInAppBillingService.Stub.asInterface(service);
                                               ^
Note: Some input files use or override a deprecated API.
 FAILED
Note: Recompile with -Xlint:deprecation for details.
3 errors

FAILURE: Build failed with an exception.
like image 903
Oliver Kocsis Avatar asked Jun 22 '18 18:06

Oliver Kocsis


2 Answers

Execute this in the root folder of your project (it copies the aidl file to the proper folder)

ionic cordova platform add android
mkdir platforms\android\app\src\main\aidl\com\android\vending\billing\
copy platforms\android\src\com\android\vending\billing\IInAppBillingService.aidl platforms\android\app\src\main\aidl\com\android\vending\billing\

Many thanks to azarus for the solution

like image 60
Oliver Kocsis Avatar answered Nov 14 '22 19:11

Oliver Kocsis


For Mac

mkdir -p platforms/android/app/src/main/aidl/com/android/vending/billing
cp platforms/android/src/com/android/vending/billing/IInAppBillingService.aidl platforms/android/app/src/main/aidl/com/android/vending/billing
like image 33
Grégoire Motot Avatar answered Nov 14 '22 18:11

Grégoire Motot