测试 Asset Delivery
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
按照本指南中的步骤,对您的应用集成 Play Asset Delivery 以检索资源包的方式进行测试。
本地测试
Play Asset Delivery 使用 bundletool
安装新版本的游戏,以此提供对本地测试的支持。使用本地测试可实现快速迭代循环,因为无需将游戏上传到 Google Play 服务器。您需要采取的步骤取决于您是在 Java、原生代码还是 Unity 中进行开发。
Java 或原生代码
请按以下步骤在本地测试您的应用:
构建您的 App Bundle。
生成带 --local-testing
标记的 APK:
java -jar bundletool-all.jar build-apks --bundle=path/to/your/bundle.aab \
--output=output.apks --local-testing
连接设备并运行 bundletool
以旁加载 APK:
java -jar bundletool.jar install-apks --apks=output.apks
Unity
在 Unity 编辑器中,依次选择 Google > Build and Run。
行为
应用安装过程中,系统将安装 install-time
个软件包。
fast-follow
软件包的行为方式类同于 on-demand
软件包。也就是说,在游戏旁加载过程中,不会自动提取这些软件包。游戏启动时,开发者需要手动请求这些软件包;此操作无需对您的应用进行任何代码更改。
限制
以下是有关本地测试的限制:
- 软件包从外部存储空间(而非 Play)提取,因此您无法测试代码在出现网络连接错误时的行为。
- 本地测试不涵盖 wait-for-Wi-Fi 场景。
- 不支持更新。在安装新版本之前,请手动卸载先前版本。
使用内部应用分享功能进行测试
在即将迎来候选版本的阶段,请使用尽可能贴近实际的配置测试游戏,以确保正式版游戏能给用户带来良好的性能体验。如需验证这一点,您可以使用内部应用分享获取一个可共享的链接,测试者可以通过该链接从 Play 中下载游戏,同时看到的行为与您的用户在游戏发布到 Play 商店后看到的行为完全相同。
如需使用内部应用分享功能测试 Asset Delivery,请执行以下操作:
- 构建您的 App Bundle。
- 按照 Play 管理中心中的说明,了解如何在内部共享您的应用。
- 在测试设备上,点击您刚上传的应用的内部应用分享链接。
- 点击该链接后,即可从所显示的 Google Play 商店页面安装此应用。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Test asset delivery\n\nUse the steps in this guide to test how your app integrates Play Asset Delivery\nto retrieve asset packs.\n\nLocal testing\n-------------\n\nPlay Asset Delivery supports local testing by installing a new version of the\ngame using [`bundletool`](/studio/command-line/bundletool). Use local testing\nfor quick, iterative cycles as it avoids the need to upload the game to Google\nPlay servers. The steps you need to take depend on whether you're\ndeveloping in Java, native, or Unity.\n\n- [Java](#steps-native-java)\n- [Native](#steps-native-java)\n- [Unity](#steps-unity)\n\n### Java or native\n\nFollow these steps to test your app locally:\n\n1. [Build your app bundle](/guide/playcore/asset-delivery#next-step-instructions).\n\n2. Generate APKs with the `--local-testing` flag:\n\n ```\n java -jar bundletool-all.jar build-apks --bundle=path/to/your/bundle.aab \\\n --output=output.apks --local-testing\n ```\n3. Connect a device and run `bundletool` to sideload the APKs:\n\n ```\n java -jar bundletool.jar install-apks --apks=output.apks\n ```\n\n### Unity\n\nIn the Unity Editor, select **Google \\\u003e Build and Run**.\n\n### Behavior\n\n`install-time` packs will be installed during the app installation process.\n\n`fast-follow` packs behave as `on-demand` packs. That is, they won't be\nautomatically fetched when the game is sideloaded. Developers need to request\nthem manually when the game starts; this does not require any code changes in\nyour app.\n\n### Limitations\n\nThe following are limitations of local testing:\n\n- Packs fetch from external storage instead of Play, so you cannot test how your code behaves in the case of network errors.\n- Local testing does not cover the wait-for-Wi-Fi scenario.\n- Updates are not supported. Before installing a new version of your build, manually uninstall the previous version.\n\nTesting with internal app sharing\n---------------------------------\n\nAs you get closer to having a release candidate, test\nyour game using as realistic a configuration as possible to make sure that your game will perform\nwell for your users in production. To validate this, you can use\n[internal app sharing](https://support.google.com/googleplay/android-developer/answer/9303479)\nto get a sharable link that you can use to download the game from Play while\ngetting the exact same behaviour as your users will once the game is\npublished to the Play Store.\n\nTo test Asset Delivery using internal app sharing, do the following:\n\n1. Build your app bundle.\n2. Follow the Play Console instructions on how to [share your app internally](https://support.google.com/googleplay/android-developer/answer/9303479).\n3. On the test device, click the internal app-sharing link for the version of your app you just uploaded.\n4. Install the app from the Google Play Store page you see after clicking the link."]]