Google Play 应用内购买返回错误代码 -1008:null puchaseData 或 dataSignature [英] Google Play In-App Purchase returns error code -1008: null puchaseData or dataSignature

查看:18
本文介绍了Google Play 应用内购买返回错误代码 -1008:null puchaseData 或 dataSignature的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在成功实施后,我正在尝试实施 Google Play 应用内购买 v3在 v2 中.但是,每次我尝试购买我真正的应用内产品时,都会收到以下后续错误:

I am attempting to implement Google Play in-app purchase v3, after successfully implementing it in v2. However, every single time I attempt to purchase one of my real in-app products, I receive the following follow-up error:

IAB 返回 null purchaseData 或 dataSignature(响应 -1008:未知错误)

IAB returned null purchaseData or dataSignature (response -1008:Unknown error)

这来自 IabHelper.java 类,第 452 行:

if (purchaseData == null || dataSignature == null) {
    logError("BUG: either purchaseData or dataSignature is null.");
    logDebug("Extras: " + data.getExtras().toString());
    result = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
    if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);
    return true;
}

我已验证 a) 我的应用已签名,b) 我的应用版本与 Google Play 商店中的草稿版本# 相匹配,并且 c) 尝试购买的用户已被添加为测试用户.我已经在 3 个测试帐户和 4 个应用内购买订阅类型中进行了尝试.

I have verified that a) my app is signed, b) the version of my app matches the draft version # on the Google Play store, and c) the user attempting the purchase has been added as a test user. I have tried this across 3 test accounts and 4 in-app purchase subscription types.

  • 我应该关注这个错误代码吗?
  • 这个问题是否仅限于非生产版本?
  • 如果/当我发布此版本时,这会影响我在现场的客户吗?
  • 您真的只能在使用 IAB 版本 3 实时发布应用内购买后进行端到端测试吗?我意识到我可以使用 android.test.purchased 项目类型,并且我有(它有效),但我不认为这是一个有效的端到端测试.

推荐答案

我自己也遇到过这个问题.过了一会儿,我发现我做错了什么.我在 IABHelper 上调用了错误的方法.

I had this problem myself. After a while I found what I did wrong. I was calling the wrong method on the IABHelper.

如果您使用在 Google Developer Console 上注册为订阅的 SKU 调用 mHelper.launchPurchaseFlow(...),则会导致错误:IAB 返回 null purchaseData 或 dataSignature(响应 -1008:未知错误).

If you call mHelper.launchPurchaseFlow(...) with an SKU that is registered as a subscription on Google Developer Console it will result in the error: IAB returned null purchaseData or dataSignature (response -1008:Unknown error).

如果您有注册为订阅的 SKU,则必须改用以下方法:mHelper.launchSubscriptionPurchaseFlow(...).

If you have a SKU that is registered as an subscription you have to use the method: mHelper.launchSubscriptionPurchaseFlow(...) instead.

希望这会有所帮助.

这篇关于Google Play 应用内购买返回错误代码 -1008:null puchaseData 或 dataSignature的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆