簡體   English   中英

Android此版本的應用程序未配置為通過Google Play計費

[英]Android This version of the applicaiton is not configured for billing through google play

我正在嘗試為我的Android應用測試In App購買情況:

我已經閱讀了有關測試的android開發者網站,並且已經成功地在play / store中構建了測試/偽造產品項,例如android.test.purchased,android.test.canceled ...

現在,我想用自己的真實產品測試In App購買。 因此,我已經在Google Play商店開發者控制台中指定了自己的產品。我還在“許可測試”中添加了測試帳戶,然后在Beta版中發布了該應用。 Beta中發布的應用程序的版本號和內部版本號與我在Android設備上安裝的用於測試的應用程序相同。

我已經比較了base64EncodedPublicKey,並且與控制台中應用程序的Base64編碼RSA公鑰相同。

我用來購買商品的Android設備。 我已將Google Play重置為只有一個帳戶,該帳戶是已經添加用於Android控制台測試的帳戶。 我已經將測試帳戶添加到我已發布的Beta應用程序中。 然后將應用程序下載到我的設備上。

我的問題是:在閱讀android指南和一些教程時,我已經做好了一切。 但是為什么當我單擊按鈕購買商品時,卻出現此錯誤:該應用程序的該版本未配置為通過Google Play計費。 請查看幫助中心以獲取更多信息。

我已經發布了將近兩個弱的應用程序。 但是我仍然遇到這個錯誤。

這是我的代碼:

@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;
}

您必須是此應用的測試人員,因此您必須在Beta測試中列出(或加入該測試的Google+小組),並且必須轉到Google Play開發人員中提供的鏈接為您的帳戶啟用Beta測試安慰。

此外,您的應用程序必須使用與Play商店Beta測試中的證書相同的證書進行簽名,因此請嘗試使用與您上傳到Google Play的apk相同的證書(例如,不是調試版本,而是您上傳的發行版)。

所需物品的完整列表。

 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.   

原始答案在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM