cordova-plugin-inapppurchase错误:包com.android.vending.billing不存在

时间:2018-06-22 18:12:48

标签: android cordova ionic-framework in-app-purchase

cordova-plugin-inapppurchase添加到我的项目中之后,为android平台构建网络资产失败:

<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.

3 个答案:

答案 0 :(得分:8)

在项目的根文件夹中执行此操作(它将aidl文件复制到正确的文件夹中)

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\

非常感谢azarussolution

答案 1 :(得分:4)

对于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

答案 2 :(得分:0)

这对我有用。 谢谢:)

ionic cordova平台添加android

mkdir平台\ android \ app \ src \ main \ aidl \ com \ android \ vending \ billing \

复制platform \ android \ src \ com \ android \ vending \ billing \ IInAppBillingService.aidl platform \ android \ app \ src \ main \ aidl \ com \ android \ vending \ billing \