2

独自の SKU/製品 ID "upgrade_to_premium" を使用してアプリ内課金をテストしようとしています。ここで推奨されているように、Dungeons サンプル アプリを使用しています。Dungeons.java の CatalogEntry[] 配列に「new CatalogEntry("upgrade_to_premium", R.string.upgrade_to_premium, Managed.MANAGED)」を追加しました。Const.java では、DEBUG が TRUE に設定されています。

リリース署名された .apk を開発者コンソールにアップロードしてアクティブ化し、この同じ .apk を adb を使用してデバイスにインストールしました。

デベロッパー コンソールに同じ名前のアプリ内アイテムを入力し、公開しました。

開発者アカウントではなく、開発者コンソールに登録されたテスト Google アカウントで電話にログインしています。このアカウントにはクレジット カード情報が関連付けられています。私はそれで音楽を買うことができます。

私のデバイスは、最新の Google Play アップグレードで Gingerbread を実行しています。

携帯電話で新しくインストールしたアプリケーションを起動すると、LogCat で予想される RestoreTransactions 呼び出しを確認できますが、RESULT_DEVELOPER_ERROR が返されます。(良いスタートではありませんか? 私はそうではないと思いますが、文書化された 5 つの異なるこのエラーの考えられる原因はここでは当てはまりません。また、文書化されていないものがいくつあるかは誰にもわかりません。) 次に、カスタム SKU upgrade_to_premium を購入しようとしましたが、「エラー」というタイトルのアラート ダイアログが表示され、「アイテムが見つかりません」というメッセージが 2 回表示されます。続けて、通常なら VISA 情報付きのマーケット (プレイ) UI を表示するのとほぼ同じ時間です。興味深いことに、無効な (つまり、未公開の) パッケージ名を含むマーケット URL を試行すると、同様のエラーが発生します。私がアップロードした未公開の下書きは、見つかっていないものですか? カスタム SKU が見つからないのですか? あいまいなエラー メッセージから判断するのは困難です。誰にも手がかりはありますか?ありがとう。

LogCat の出力は次のとおりです。

06-13 00:08:31.858: D/Finsky(589): [1] 5.onFinished: Installation state replication    succeeded.
06-13 00:08:43.729: I/ActivityManager(109): Starting: Intent {  act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000  cmp=com.augmentedmind.dungeons/.Dungeons } from pid 196
6-13 00:08:43.795: I/ActivityManager(109): Start proc com.augmentedmind.dungeons for activity com.augmentedmind.dungeons/.Dungeons: pid=1247 uid=10054 gids={}
06-13 00:08:44.198: D/BillingService(1247): CheckBillingSupported
06-13 00:08:44.198: I/BillingService(1247): binding to Market billing service
06-13 00:08:44.213: D/BillingService(1247): CheckBillingSupported
06-13 00:08:44.213: I/BillingService(1247): binding to Market billing service
06-13 00:08:44.221: D/BillingService(1247): Billing service connected
06-13 00:08:44.225: D/BillingService(1247): CheckBillingSupported
06-13 00:08:44.237: D/Finsky(589): [26] MarketBillingService.getPreferredAccount:  com.augmentedmind.dungeons: Account from first account.
06-13 00:08:44.241: I/BillingService(1247): CheckBillingSupported response code: RESULT_OK
06-13 00:08:44.241: I/Dungeons(1247): supported: true
06-13 00:08:44.241: D/BillingService(1247): RestoreTransactions
06-13 00:08:44.245: D/Finsky(589): [8] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:08:44.249: D/Finsky(589): [8] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:08:44.260: I/ElegantRequestDirector(589): I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
06-13 00:08:44.260: E/BillingService(1247): restoreTransactions received RESULT_OK
06-13 00:08:44.260: D/BillingService(1247): request id: 2247584787757221561
06-13 00:08:44.260: I/ElegantRequestDirector(589): Retrying request
06-13 00:08:44.268: D/BillingService(1247): request id: -1
06-13 00:08:44.268: D/BillingService(1247): CheckBillingSupported
06-13 00:08:44.272: D/Finsky(589): [7] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:08:44.272: I/BillingService(1247): CheckBillingSupported response code: RESULT_OK
06-13 00:08:44.272: I/Dungeons(1247): supported: true
06-13 00:08:44.272: D/BillingService(1247): request id: -1
06-13 00:08:44.346: I/ActivityManager(109): Displayed com.augmentedmind.dungeons/.Dungeons: +556ms
06-13 00:08:44.729: D/Finsky(589): [1] MarketBillingService.sendResponseCode: Sending response RESULT_DEVELOPER_ERROR for request 2247584787757221561 to com.augmentedmind.dungeons.
06-13 00:08:44.741: I/BillingService(1247): handleCommand() action: com.android.vending.billing.RESPONSE_CODE
06-13 00:08:44.741: D/BillingService(1247): RestoreTransactions: RESULT_DEVELOPER_ERROR
06-13 00:08:44.741: D/Dungeons(1247): RestoreTransactions error: RESULT_DEVELOPER_ERROR
06-13 00:09:28.049: D/Dungeons(1247): buying: Upgrade app to premium sku: upgrade_to_premium
06-13 00:09:28.053: D/BillingService(1247): RequestPurchase
06-13 00:09:28.092: D/Finsky(589): [26] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:09:28.096: D/Finsky(589): [26] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:09:28.100: I/ActivityManager(109): Starting: Intent { act=android.intent.action.VIEW cmp=com.android.vending/com.google.android.finsky.activities.IabActivity (has extras) } from pid -1
06-13 00:09:28.104: D/BillingService(1247): request id: 137676918944123250
06-13 00:09:28.104: D/BillingService(1247): RequestPurchase
06-13 00:09:28.108: D/Finsky(589): [27] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:09:28.112: D/Finsky(589): [27] MarketBillingService.getPreferredAccount: com.augmentedmind.dungeons: Account from first account.
06-13 00:09:28.112: I/ActivityManager(109): Starting: Intent { act=android.intent.action.VIEW cmp=com.android.vending/com.google.android.finsky.activities.IabActivity (has extras) } from pid -1
06-13 00:09:28.116: D/BillingService(1247): request id: 5138873787070031749
06-13 00:09:28.174: D/Finsky(589): [1] SelfUpdateScheduler.checkForSelfUpdate: Skipping self-update. Local Version [8011019] >= Server Version [0]
06-13 00:09:28.381: I/ActivityManager(109): Displayed com.android.vending/com.google.android.finsky.activities.IabActivity: +262ms
06-13 00:09:28.413: E/Volley(589): [13] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/details?doc=subs:com.augmentedmind.dungeons:upgrade_to_premium
06-13 00:09:41.670: W/InputManagerService(109): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40796830
06-13 00:09:41.737: D/Finsky(589): [1] SelfUpdateScheduler.checkForSelfUpdate: Skipping self-update. Local Version [8011019] >= Server Version [0]

この頃、デバイス画面に「エラー」というタイトルのポップアップ ダイアログが表示され、「項目が見つかりません」というメッセージが 2 回表示されます。ちょうどマーケット(プレイ)のUIとVISA情報が表示されている頃です。

06-13 00:09:41.881: D/Finsky(589): [1] MarketBillingService.sendResponseCode: Sending response RESULT_ERROR for request 5138873787070031749 to com.augmentedmind.dungeons.
06-13 00:09:41.889: I/BillingService(1247): handleCommand() action: com.android.vending.billing.RESPONSE_CODE
06-13 00:09:41.889: D/BillingService(1247): RequestPurchase: RESULT_ERROR
06-13 00:09:41.893: D/Finsky(589): [1] PendingNotificationsService.setMarketAlarm: Setting alarm for account=tester.android30@gmail.com, duration=120000
06-13 00:09:41.940: I/ActivityManager(109): Displayed com.android.vending/com.google.android.finsky.activities.IabActivity: +271ms
06-13 00:09:41.991: E/Volley(589): [14] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/details?doc=inapp:com.augmentedmind.dungeons:upgrade_to_premium
06-13 00:09:45.600: W/InputManagerService(109): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@407daea0
06-13 00:09:45.682: D/Finsky(589): [1] MarketBillingService.sendResponseCode: Sending response RESULT_ERROR for request 137676918944123250 to com.augmentedmind.dungeons.
06-13 00:09:45.690: D/Finsky(589): [1] PendingNotificationsService.setMarketAlarm: Setting alarm for account=tester.android30@gmail.com, duration=120000
06-13 00:09:45.698: I/BillingService(1247): handleCommand() action:       com.android.vending.billing.RESPONSE_CODE
06-13 00:09:45.698: D/BillingService(1247): RequestPurchase: RESULT_ERROR
06-13 00:09:45.698: D/Dungeons(1247): upgrade_to_premium: RESULT_ERROR
06-13 00:09:45.698: I/Dungeons(1247): purchase failed

PS「有効になるまで1時間ほど待たなければならないかもしれない」とどこかで読みましたが、未公開のドラフトアップロードの場合はそうではないことを心から願っています! 誰も見ることのないこの種のアップロードが遅延するのはなぜですか? ...この未公開の下書きアプリのアップロード/削除/再アップロードを繰り返すことで、アップロード クォータに達したので、これは本当だと思い始めています。アプリ内課金をマスターするのと同じくらい苦痛ですが、その余分な煩わしさは必要ありません. ダメだ、グーグル。

4

4 に答える 4

10

これを機能させるには、(アプリではなく)製品を公開する必要があります。そして、はい、あなたは少し待つ必要があります。おそらく、APKの状態がすべてのGooglePlayサーバーに複製されている間です。約1年前はすぐに機能していましたが、現在はそうではありません。ただし、同じAPKをアップロードしてテストする必要はなく、バージョンと署名のみが一致する必要があります。したがって、新しいバージョンの開発を開始するときは、マニフェストでバージョンをバンプし、署名されたAPKをエクスポートしてアップロードするだけです。開発とテストを行う間、そこに置いておきます。次に、公開時に最終的なバイナリに置き換えます。

于 2012-06-13T08:17:31.793 に答える
0

base64EncodedPublicKeyセキュリティクラスの変数に公開鍵を設定します。

署名されたapkを使用してアプリの課金をテストします。

于 2012-06-13T08:17:24.760 に答える
0

デモの Dungeons.java には、非常に誤解を招くエラーやダイアログが表示されることに注意してください。

--

「エラー: このバージョンのアプリケーションは、Market 課金用に構成されていません」というメッセージが表示される場合。

エミュレーターではなく、Android DEVICEにRELEASE apk をインストールする必要があります。

  • APK をエクスポートして署名する

  • デバイス上のアプリの以前のインストールを削除する (デバッグ バージョンや開発者バージョンも!)

  • APK をデバイスにサイドロードし、インストールして実行します。

  • これは、リリースされたアプリのデバッグが、おそらくデバッガーが接続されていないことを意味します。デバッガが接続されている場合は、その方法を教えてください!

「エラー: アイテムが見つかりません」というメッセージが表示された場合は、何も問題がない可能性があります。

Dungeons.java には実際にバグがあります。説明させてください:

/**
 * Called when a button is pressed.
 */
@Override
public void onClick(View v) {
    if (v == mBuyButton) {
        if (Consts.DEBUG) {
            Log.d(TAG, "buying: " + mItemName + " sku: " + mSku);
        }

        if (mManagedType != Managed.SUBSCRIPTION &&
                 // ** The following line is bug when returns !true which is false, and then makes the if statement false
                !mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_INAPP, mPayloadContents)) { 
            showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);

            // ** Which then ends up running this else if, meaning it will try to purchase a subscription
        } else if (!mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_SUBSCRIPTION, mPayloadContents)) {
            // Note: mManagedType == Managed.SUBSCRIPTION
            showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
        }
    } else if (v == mEditPayloadButton) {
        showPayloadEditDialog();
    } else if (v == mEditSubscriptionsButton) {
        editSubscriptions();
    }
}

むしろ、次のように記述する必要があります。

/**
 * Called when a button is pressed.
 */
@Override
public void onClick(View v) {
    if (v == mBuyButton) {
        if (Consts.DEBUG) {
            Log.d(TAG, "buying: " + mItemName + " sku: " + mSku);
        }

        // We need this statement to evaluate to true on a Non-Subscription such as a Managed or Unmanaged Purchase
        if (mManagedType != Managed.SUBSCRIPTION) { 

                // If the following errors out, show an error dialog.  However, it should not make the previous if statement false
                if( !mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_INAPP, mPayloadContents)) { 
                    showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
                }

        } 

         // This if statement gets run accidentally without the bug fix, thus trying to buy your "SKU" as a "subscription", which is totally wrong!
        else if (!mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_SUBSCRIPTION, mPayloadContents)) { 
            // Note: mManagedType == Managed.SUBSCRIPTION
            showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
        }
    } else if (v == mEditPayloadButton) {
        showPayloadEditDialog();
    } else if (v == mEditSubscriptionsButton) {
        editSubscriptions();
    }
}
于 2012-11-29T20:45:29.337 に答える
0

これを試して:

アプリを APK ファイルとしてエクスポートします。APK を Google Play にアップロードします。同じ APK をテスト デバイスにサイドロードします。Google Play がサーバーを更新するまで 1 時間ほど待ちます。インストールされた APK をテストします。

于 2014-09-12T10:26:21.237 に答える