the Android Billing Docs描述的getBuyIntentExtraParams
方法在我的项目中似乎无法正常工作。
我看到有一个 open issue在 github 上建议抓取 the AIDL file from the Trivial Drive Android example application ,但即使这样做之后,我也无法使 v6 API 正常工作(我收到 cannot find symbol
错误)。
我的调用如下:
Bundle extraParams = new Bundle();
extraParams.putBoolean("replaceSkusProration", true);
String ownedSku = "someSkuAlreadyOwnedByTheUser";
ArrayList<String> replaceSkus = new ArrayList<String>();
replaceSkus.add(ownedSku);
extraParams.putStringArrayList("skusToReplace", replaceSkus);
Bundle buyIntentBundle = mService.getBuyIntentExtraParams(6,
getPackageName(), sku, "subs", "BigOlRandomString", extraParams);
关于计费的其他一切似乎都正常...我在这里缺少什么?
编辑:我绝对可以让 API v5 正常工作,因为 Android Studio 非常乐意让我使用 getBuyIntentToReplaceSkus
函数。
最佳答案
嗨!
听起来您的构建没有从 IInAppBillingService.aidl
文件生成 IInAppBillingService.java
。或者,如果它正在 生成 java 文件,则生成的版本未被您的项目引用。归根结底,java 文件中的方法声明是您的代码可以引用的内容,以解决 cannot find symbol
错误。
我的特定项目不使用 AndroidStudio 或 gradle,因此我无法评论如何解决此步骤中的任何问题。不过,Google 确实提供了一些相关文档:Adding the AIDL file to your project .我相信目录和文件位置需要非常精确才能让 AndroidStudio 拾取它。
请确保,一旦您执行,解决找不到符号
错误,您传递的 API 版本至少为 6
到第一个参数。
希望这能在 8 个月后为您解封 :D 祝您好运!
关于android - getBuyIntentExtraParams 不存在?也就是如何使用第 6 版应用内结算 API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41834529/