问题描述
我从 Google Play IAB API 获得以下信息;
I am getting the following from the Google Play IAB API;
您要求的商品无法购买
然而,我已经成功测试了静态响应,此外,以下代码在可用产品列表中返回 myProductId
;
I have however successfully tested against static responses, and in addition, the following code returns myProductId
in the list of available products;
ArrayList<String> skuList = new ArrayList<String> ();
skuList.add("myProductId");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
Bundle skuDetails = service.getSkuDetails(3, activity.getPackageName(), "inapp", querySkus);
另外我有;
- 发布了一个测试版 APK
- 将测试用户添加到测试版并通过 URL 选择加入
- 使用测试用户(gmail 帐户)登录设备
- 将具有相同版本代码的签名 APK 推送到设备
- 激活产品
我使用的购买代码是;
Bundle buyIntentBundle = service.getBuyIntent(3, activity.getPackageName(), "myProductId", "inapp", "payload");
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
activity.startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
最后logcat显示如下;
Finally, logcat shows the following;
D/Finsky: [1] PurchaseFragment.onStateChange: Error: PurchaseError{type=3 subtype=0}
D/Finsky: [1] PurchaseFragment.onStateChange: Purchase failed: PurchaseError{type=3 subtype=0}
虽然还有其他与此问题相关的问题,但没有一个可以为我解决;
Whilst there are other questions related to this issue, none of them solve it for me;
- 您请求的商品无法购买一个>
- 产品有效
- 使用静态响应测试产品
android.test.purchased
成功
- 测试用户登录
推荐答案
在我上次测试 12 小时后,这神秘地起作用了.症状是:
12 hours after my last test this was mysteriously working. The symptoms were:
- 如果应用程序是通过 ADB(发布并签名)安装到设备上,则购买不可用
- 如果应用是通过 Google Play 安装的(下载),则可以正常购买
我不确定到底是什么解决了这个问题.在等待 12 小时之前我;
What exactly fixed this i'm unsure. Prior to waiting 12 hours I;
- 从直接使用
IInAppBillingService
切换到使用 Google 的IABHelper
.直接影响仍然是无法购买产品,但是文本现在显示为红色而不是黑色(什么?),并且 DFinsky 错误更改为子类型 4;PurchaseError{type=3 subtype=4}
.我还注意到直接使用IInAppBillingService
时我没有使用 base64EncodedKey. - 切换到多个 APK(可能是红鲱鱼)
- 开始了 alpha 测试(之前只使用 beta 测试)
- 创建了一个新的 gmail 帐户并将其添加给测试人员
- Switched from using
IInAppBillingService
directly to using Google'sIABHelper
. The immediate effect was still product unavailable for purchase, however the text was now displayed in red rather than black (what?) and the DFinsky error changed to subtype 4;PurchaseError{type=3 subtype=4}
. I also note that i was not using base64EncodedKey when usingIInAppBillingService
directly. - Switched to multiple APKs (probably red-herring)
- Started an alpha test (was previously using a beta test only)
- Created a new gmail account and added it to testers
即使进行了所有这些更改,问题仍然存在,所以我上床睡觉,今天早上醒来,没有进一步的更改,它就正常工作了.FML.
Even after all these changes, the issue was still occurring, so I went to bed, woke up this morning and with no further changes it just worked. FML.
这篇关于GooglePlay:您请求的项目无法购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!