跳转到相应内容

最常访问

最近访问

navigation

Testing Your In-app Billing App

This lesson teaches you to

  1. Test with static responses
  2. Test with your own product IDs

You should also read

To ensure that In-app Billing is functioning correctly in your app, you must test the app before you publish it on Google Play. Early testing also helps to ensure that the user flow for purchasing in-app items is not confusing or slow, and that users can see their newly purchased items in a timely way.

Test with static responses

Test your In-app Billing app with static responses by using Google Play's reserved product IDs. By using reserved product IDs instead of actual product IDs, you can test the purchase flow without specifying an actual payment method or transferring money. To learn more about reserved product IDs, see Testing In-app Billing.

Test with your own product IDs

Because Google Play doesn't allow you to use your developer account to directly purchase in-app products that you create yourself, you need to create test acccounts under your developer account profile. To create a test account, simply enter a valid Google email address. Users with these test accounts are able to make in-app-billing purchases from uploaded, unpublished apps that you manage. The signature of the unpublished apps doesn't need to match the published versions.

To test your In-app Billing app using your own product IDs:

  1. In the Play Console, add one or more tester accounts to the developer account that you are using to publish your app by completing the following steps:

    a. Login to the Play Console with your developer account.

    b. Click Settings > Developer account > Account details, and then in the License Testing section, add the Google email addresses for your tester accounts.

  2. Build a signed APK file for your In-app Billing app. To learn how to build and sign your APK, see Building Your Application for Release.

  3. Make sure that you have uploaded the signed APK for your app to the Play Console, and associated one or more in-app products with your app. You don't need to publish the app on Google Play to test it.

  4. Install the APK file to your physical test device by using either the adb tool, or the Play button in Android Studio. To learn how to install the app, see Running on a Device. Make sure that your test device is running on Android 2.2 (API level 8) or higher and is installed with Google Play client Version 3.9.16 or higher.

  5. Login to the test device by using a tester account. Test your In-app Billing app by purchasing a few items, and fix any issues that you encounter. To learn more about how you can perform large-scale testing of your In-app Billing app, see Test Purchases (In-app Billing Sandbox).

此网站会使用 Cookie 来存储您在此网站上指定的语言和显示选项偏好设置。

获取最新的 Android Developers 资讯和提示,助您在 Google Play 上取得成功。

* 必填字段

成功!

在微信上关注 Google Developers

要以浏览此网站吗?

您请求访问的是网页,但是您为此网站设置的语言偏好为

要更改您的语言偏好设置并以浏览此网站吗?如果以后您想要更改语言偏好设置,请使用每个页面底部的语言菜单。

该类需要 或更高的 API 级别

此文档已被隐藏,因为您为该文档选择的 API 级别是 。您可以使用左侧导航栏上方的选择器来更改文档的 API 级别。

要详细了解如何根据您的应用需求指定 API 级别,请参阅支持不同平台版本

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)