我正在尝试使用我自己的 sku/产品 ID“upgrade_to_premium”测试应用内计费。正如我在这里看到的推荐,我使用的是地下城示例应用程序。我在 Dungeons.java 的 CatalogEntry[] 数组中添加了一个“new CatalogEntry("upgrade_to_premium", R.string.upgrade_to_premium, Managed.MANAGED)”。在 Const.java 中,DEBUG 设置为 TRUE。
我已将发布签名的 .apk 上传到我的开发者控制台并激活它,并使用 adb 将相同的 .apk 安装到我的设备上。
我在开发控制台中输入了一个同名的应用内产品,并发布了它。
我不是使用我的开发者帐户登录我的手机,而是使用在我的开发者控制台注册的测试 Google 帐户。此帐户有关联的信用卡信息;我可以用它购买音乐。
我的设备正在运行 Gingerbread,并带有最新的 Google Play 升级。
在我的手机上启动新安装的应用程序后,我在 LogCat 中观察到预期的 RestoreTransactions 调用,但它返回 RESULT_DEVELOPER_ERROR。(不是一个好的开始?我想不是,但是记录了五个不同的此错误的可能原因不适用于此处,谁知道有多少未记录的。)然后我尝试购买我的自定义 sku upgrade_to_premium,但我收到一个标题为“错误”的警报对话框,并显示消息“未找到项目”,两次接连,就在它通常会显示带有 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]
大约在这个时候,我在设备屏幕上弹出一个对话框,标题为“错误”,并显示消息“未找到项目”,两次。就在它通常会显示带有 VISA 信息的市场 (Play) UI 的时候。
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 我在某处读到“可能需要等待一个小时左右才能激活它”,但我真诚地希望未发布的草稿上传不是这种情况!为什么这种用户永远看不到的上传会受到延迟?...我开始认为这是真的,因为通过重复上传/删除/重新上传这个未发布的草稿应用程序,我刚刚达到了上传配额。就像掌握应用内计费一样痛苦,我不需要那种额外的烦恼。不好,谷歌。