【问题标题】:Android This version of the applicaiton is not configured for billing through google playAndroid 此版本的应用程序未配置为通过 google play 计费
【发布时间】:2016-02-01 11:23:29
【问题描述】:

我正在尝试为我的 Android 应用测试应用内购买:

我已经阅读了有关测试的 android 开发者网站,并且我已经成功地使用了内置测试/假冒产品项目的游戏商店,例如 android.test.purchased、android.test.canceled ...

现在我想用我自己的真实产品测试应用内购买。因此,我在 Google Play 商店开发者控制台中指定了我自己的产品。我还在 LICENSE TESTING 中添加了测试帐户,然后我在 beta 中发布了该应用程序。测试版中发布的应用的版本号和内部版本号与我安装在安卓设备上进行测试的应用相同。

我已经比较了 base64EncodedPublicKey,它与控制台中应用程序的 Base64 编码 RSA 公钥相同。

我用来购买商品的 Android 设备。我已将 google play 重置为只有一个帐户,该帐户已添加用于在 Android 控制台中进行测试。我已经为我发布的 beta 应用添加了测试帐户。然后我已经将应用程序下载到我的设备上。

我的问题是:在阅读 android 指南和一些教程时,我已经做好了一切。但是为什么当我点击按钮购买该项目时,我有这个错误:这个版本的应用程序没有配置为通过谷歌播放计费。查看帮助中心了解更多信息。

我在将近两年前发布了我的应用程序。但我仍然收到此错误。

这是我的代码:

@Override
protected void onStart() {
    super.onStart();

    //Toast.makeText(DetailActivity.this, "On Start", Toast.LENGTH_SHORT).show();

    String base64EncodedPublicKey ="";
    mHelper = new IabHelper(this, base64EncodedPublicKey);

    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        @Override
        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                Log.d(TAG, "In-app Billing setup failed: " + result);
                Toast.makeText(DetailActivity.this, "Fail", Toast.LENGTH_SHORT).show();
            } else {
                Log.d(TAG, "In-app Billing is set up OK");
                Toast.makeText(DetailActivity.this, "Success", Toast.LENGTH_SHORT).show();
            }
        }
    });

}
@Override
    protected void onActivityResult(int requestCode, int resultCode,
                                    Intent data)
    {
        if (!mHelper.handleActivityResult(requestCode,resultCode, data)) {
            super.onActivityResult(requestCode, resultCode, data);
        }
    }

public void buyMethod(View v){

    //mHelper.launchPurchaseFlow(this, ITEM_SKU, 10001, mPurchaseFinishedListener, "storyone");

    mHelper.queryInventoryAsync(mGotInventoryListener);

}

//make purchase payment
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
        = new IabHelper.OnIabPurchaseFinishedListener() {
    public void onIabPurchaseFinished(IabResult result, Purchase purchase)
    {
        if (result.isFailure()) {
            Log.d(TAG, "Error purchasing: " + result);
            Toast.makeText(DetailActivity.this, "Buy Fail", Toast.LENGTH_SHORT).show();
            return;
        }
        else if (purchase.getSku().equals(ITEM_SKU)) {
            //
            Toast.makeText(DetailActivity.this, "Buy Success", Toast.LENGTH_SHORT).show();
        }
    }
};


//check use has already make payment
IabHelper.QueryInventoryFinishedListener mGotInventoryListener
        = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result,
                                         Inventory inventory) {

        if (result.isFailure()) {
            // handle error here
        }
        else {
            // does the user have the premium upgrade?
            boolean mIsPremium = inventory.hasPurchase(ITEM_SKU);
            if (mIsPremium){
                Toast.makeText(DetailActivity.this, "You already buy this product", Toast.LENGTH_SHORT).show();
            }else{
                Toast.makeText(DetailActivity.this, "Not Yet buy this product", Toast.LENGTH_SHORT).show();
                mHelper.launchPurchaseFlow(DetailActivity.this, ITEM_SKU, 10001, mPurchaseFinishedListener, "storyone");
            }
            // update UI accordingly
        }
    }
};

@Override
public void onDestroy() {
    super.onDestroy();
    if (mHelper != null) mHelper.dispose();
    mHelper = null;
}

【问题讨论】:

标签: android in-app-purchase


【解决方案1】:

您必须是此应用的测试人员,因此您必须参加 Beta 测试(或加入 Google+ 群组进行测试)并且必须为您的帐户启用 Beta 测试通过转到 Google Play 开发者控制台中提供的链接。

此外,您的应用程序必须使用与 Play 商店 beta 测试中的证书相同的证书进行签名,因此请使用您上传到 Google Play 的相同 apk 进行尝试(例如,不是调试版本,而是您发布的版本)已上传)。

【讨论】:

  • 谢谢,我检查了测试帐户后。现在我可以购买了。
【解决方案2】:

所需物品的完整清单。

 Prerequisites:

AndroidManifest must include "com.android.vending.BILLING" permission.
APK is built in release mode.
APK is signed with the release certificate(s).
APK is uploaded to alpha/beta distribution channel (previously - as a draft) 
to the developer console at least once. (takes some time ~2h-24h).
IAB products are published and their status set to active.
Test account(s) is added in developer console.
Testing requirements:

Test APK has the same versionCode as the one uploaded to developer console.
Test APK is signed with the same certificate(s) as the one uploaded to 
dev.console.
Test account (not developer) - is the main account on the device.
Test account is opted-in as a tester and it's linked to a valid payment method.   

Original answer here

【讨论】:

    猜你喜欢
    • 2012-06-19
    • 2012-11-22
    • 1970-01-01
    • 2012-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-23
    相关资源
    最近更新 更多