“边下载边玩”功能最佳实践
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
为您的应用启用“边下载边玩”功能后,这些最佳实践可以缩短安装延迟时间。
使用最新的 SDK
为您的应用使用最新的 SDK,尤其是在您使用以下 SDK 时:
最新的 SDK 针对“边下载边玩”功能进行了优化,可在不扫描整个应用二进制文件的情况下运行。这样一来,用户在首次启动时就能更快地启动您的应用。
使用安装时分发资源包
您可使用安装时分发资源包来存储大型游戏资源。Google Play 通过分析安装时分发资源包的使用模式来优化下载。这有助于加快游戏的启动速度,同时在游戏初次启动期间仅下载用户需要的数据。
下表显示了当游戏搭配使用 Android App Bundle 和 Play Assets Delivery 时,“边下载边玩”功能会优化哪些代码和资源。
资源格式 |
“边下载边玩”功能已优化 |
“边下载边玩”功能未优化 |
Android App Bundle 文件 |
基本模块和安装时分发动态功能(除“res/”和“values/”目录之外) |
基本模块和安装时分发动态功能的“res/”和“values/”目录 |
|
按需分发动态功能 |
Play Asset Delivery 文件 |
安装时分发资源包 |
快速跟进式分发资源包 |
|
按需分发资源包 |
限制预加载资源的数量
应仅加载当前用户体验所需的内容(如菜单或关卡),而不是一次性预加载所有应用资源。在初始体验期间加载过多资源,会预先消耗更多网络流量。
以下是针对 Unity 游戏的一些其他建议:
修复 ANR 错误
通过修复应用中的 ANR(“应用无响应”错误),您还可以改善应用的“边下载边玩”体验。例如,通过移除主线程中的 IO 操作,您可以最大限度地减少 Play 在后台下载应用资源时发生的 ANR。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Play as you Download best practices\n\nThese best practices can improve install latency when Play as you Download\nis enabled for your app.\n\nUse the latest SDKs\n-------------------\n\nUse the latest SDKs for your app, especially if you are using the following\nSDKs:\n\n- Facebook Core SDK: 11.2.0 or higher\n\n- FB Audience Network (ads): 6.5.1 or higher\n\nThe latest SDKs are optimized for Play as you Download to operate without\nscanning the entire app binary. This lets users start your app more quickly\nthe first time they launch.\n\nUse install-time asset packs\n----------------------------\n\nUse [install-time](/guide/playcore/asset-delivery#delivery-modes) asset packs to\nstore large game assets. Google Play optimizes downloads by analyzing use\npatterns of install-time asset packs. This helps the game launch much faster\nwhile only downloading data that users need during the initial game launch.\n\nThe following table shows what code and resources are optimized by Play as you\ndownload when games use an\n[Android App Bundle with Play Assets Delivery](/guide/app-bundle/app-bundle-format).\n\n| Resource format | Optimized by Play as you Download | Not optimized by Play as you Download |\n|---------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| Android App Bundle files | Base Module and install-time dynamic features (except 'res/' and 'values/' directories) | \\`res/\\` and \\`values/\\` directories of base module and install-time dynamic features |\n| Android App Bundle files | | On-demand dynamic features |\n| Play Asset Delivery files | Install-time asset packs | Fast-follow asset packs |\n| Play Asset Delivery files | | On-demand asset packs |\n\nLimit preloaded assets\n----------------------\n\nInstead of preloading all app assets at once, only load what's needed for the\ncurrent user experience such as the menu or level. Loading too many assets\nduring the initial experience uses more network data up front.\n\nHere are some additional recommendations for Unity games:\n\n- See\n [Loading resources at runtime](https://docs.unity3d.com/2022.2/Documentation/Manual/LoadingResourcesatRuntime.html).\n\n- Split large scenes into multiple scenes to avoid loading large amounts of\n asset data at once.\n\n- Use an asset loading profiler (such as the\n [Asset Loading Profiler module in\n Unity](https://docs.unity3d.com/2022.2/Documentation/Manual/profiler-asset-loading-module.html))\n to identify asset loading optimizations for your game.\n\nFix ANRs\n--------\n\nBy fixing [ANRs](/topic/performance/vitals/anr)\n(Application Not Responding errors) in your app, you can also improve the Play\nas you Download experience of the app. For example, by removing\n[IO operations from the main thread](https://developer.android.com/topic/performance/vitals/anr#io_on_the_main_thread),\nyou can minimize ANRs from occurring while Play is downloading app assets in\nbackground."]]