Android In App Billing"计费服务在设备上不可用。 (回复:3:账单不可用)"

时间:2015-02-13 19:03:10

标签: android in-app-billing

我构建了Android游戏,在应用程序购买方面有很高的优势,而且我有一段时间没有工作。 (该游戏属于beta测试分支,用户可以购买高级升级版。)

几天前我决定改写项目,所以我可以稍微清理一下我的代码。一切似乎都很好。 (播放游戏服务和AdMob广告仍然有效)但是,在应用计费中不再有效。每次我的应用程序启动时都会收到错误:"Billing service unavailable on device. (response: 3:Billing Unavailable)"我到处搜索,发现很多人都有这个问题,但他们的答案都没有帮助我。

我试过了:

  • 清除Google Play应用的缓存,并通过启动应用程序接受条款。
  • 在手机上试用多个用户。 (所有这些都已添加到开发人员控制台的测试人员列表中。)
  • 测试至少3个其他(非根)设备。
  • 仔细检查"com.android.vending.BILLING"权限是否在我的清单文件中。
  • 使用相同的密钥库签署我的新申请。
  • 为我的新项目使用完全相同的命名空间。
  • 尝试3种不同的Play商店版本。

这是我的iabHelper代码。

String base64EncodedPublicKey = "KEY HERE";

iabHelper = new IabHelper(this, base64EncodedPublicKey);
iabHelper.enableDebugLogging(true);
iabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
    @Override
    public void onIabSetupFinished(IabResult result) {
        if (!result.isSuccess()) {
            Log.e(TAG, "Problem setting up in-app billing: " + result.getMessage());
            return;
        }

        if (iabHelper == null) return;

        iabHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
            @Override
            public void onQueryInventoryFinished(IabResult result, Inventory inv) {
                if (iabHelper == null) return;

                if (result.isFailure()) {
                    Log.e(TAG, "Failed to query inventory: " + result);
                    return;
                }

                Purchase premiumPurchase = inv.getPurchase("premium");
                isPremium = (premiumPurchase != null);

                if (!premium())
                    loadInterstitial();
           }
        });
    }
});

和我的onActivityResult代码

我很确定这没有正确完成,但我不认为这与此错误有关。 (在调试时看到错误之前,甚至没有调用它。)

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

    // Pass on the activity result to the helper for handling
    if (!iabHelper.handleActivityResult(requestCode, resultCode, data)) {
        if (resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED)
            gameHelper.disconnect();
        gameHelper.onActivityResult(requestCode, resultCode, data);
        super.onActivityResult(requestCode, resultCode, data);
    } else {
        Log.i(TAG, "onActivityResult handled by IABUtil.");
    }
}

我通常不喜欢寻求帮助,因为答案通常可以在网上访问。但是,我已经在这几天了,而且我已经把我所有的头发都扯掉了。感谢您提供的任何帮助。

我现在最好的猜测是我忘了复制原始项目中的某些东西,导致它失败,但除了base64EncodedPublic键,我的密钥库以及使用它之外,我想不出任何东西。命名空间。我错过了什么吗?

0 个答案:

没有答案