Google Play 应用内购买返回错误代码 -1008:null puchaseData 或 dataSignatu

2023-11-09移动开发问题
10

本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何在 COCOS2d Android 中使用 CClistview?
How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)...
2024-08-12 移动开发问题
5

cocos2d-android:如何显示分数
cocos2d-android: how to display score(cocos2d-android:如何显示分数)...
2024-08-11 移动开发问题
7

从 Iphone Native Client 使用 Google App Engine 进行身份验证
Authenticate with Google App Engine from an Iphone Native Client(从 Iphone Native Client 使用 Google App Engine 进行身份验证)...
2024-08-11 移动开发问题
4

Sqlite 数据库未从资产文件夹 Android 复制
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)...
2024-04-15 移动开发问题
8

SQLite 数据库副本在由设备而不是模拟器生成时出现损坏
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)...
2024-04-15 移动开发问题
4

安卓文件拷贝
Android file copy(安卓文件拷贝)...
2024-04-15 移动开发问题
6