Android App Bundle 简介
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android App Bundle 是一种发布格式,其中包含应用的所有经过编译的代码和资源,可将 APK 生成和签名工作交给 Google Play 来完成。
Google Play 会使用您的 app bundle 针对每种设备配置生成并提供经过优化的 APK,因此只会下载特定设备所需的代码和资源来运行您的应用。您不必再构建、签署和管理多个 APK 来优化对不同设备的支持,而用户也可以获得更小且更优化的下载文件包。
对于大多数应用项目而言,构建 app bundle 以支持提供经过优化的 APK 并不费力。如果您已按照既定惯例组织应用的代码和资源、使用 Android Studio 或使用命令行构建签名的 Android App Bundle 并将其上传到 Google Play,那么优化的 APK 提供将会自动成为一项优势。
使用 app bundle 格式发布应用时,您还可以选择利用 Play Feature Delivery,它可让您向应用项目添加功能模块。这些模块包含仅根据您指定的条件随应用提供的功能和资源,或者稍后在运行时供使用 Play 核心库下载的功能和资源。
使用 app bundle 发布应用的游戏开发者可以使用 Play Asset Delivery:这是 Google Play 用于分发大量游戏资产的解决方案,为开发者提供了灵活的分发方法和出色的性能。
请观看下面的视频,大致了解为什么应使用 Android App Bundle 发布应用。
对压缩后的下载大小的限制
使用 Android App Bundle 发布应用有助于用户以尽可能最小的下载大小安装您的应用,并增加压缩下载大小。也就是说,当用户下载您的应用时,安装应用所需的压缩 APK(例如,基本 APK + 配置 APK)的总大小不得超过 4 GB。任何后续下载内容(如按需下载功能模块及其配置 APK)也必须满足此压缩下载大小限制。Asset Pack 不受此大小限制,但它们有其他大小限制。
如果 Play 管理中心发现您的应用或其按需功能的任何可能下载项超出大小上限,您会收到错误消息。
请注意,Android App Bundle 不支持 APK 扩展 (*.obb
) 文件。因此,如果您在发布 app bundle 时遇到此错误,请使用以下某种资源来缩减压缩的 APK 下载大小:
- 请务必通过为每种类型的配置 APK 设置
enableSplit = true
来启用所有配置 APK。这样可以确保用户只下载在其设备上运行您的应用所需的代码和资源。
- 请务必移除不用的代码和资源以缩减应用大小。
- 遵循最佳做法以进一步缩减应用大小。
- 考虑将只有部分用户使用的功能转换为应用可以在日后按需下载的功能模块。请注意,这可能需要对应用进行一些重构,因此请务必先尝试所述的其他建议。
其他注意事项
以下是使用 Android App Bundle 构建或提供应用时会出现的已知问题。如果您遇到本文未详述的问题,请报告 bug。
- 部分安装旁加载的应用(即,未通过 Google Play 商店安装且缺少一个或多个必需拆分 APK 的应用)在所有经过 Google 认证的设备上以及搭载 Android 10(API 级别 29)或更高版本的设备上都会失败。通过 Google Play 商店下载您的应用时,Google 会确保安装应用的所有必需组件。
如果您使用会动态修改资源表的工具,则从 app bundle 生成的 APK 可能会行为异常。因此,在构建 app bundle 时,建议您停用此类工具。
在功能模块的 build 配置中,您可以配置与基本模块或其他模块中的属性冲突的属性。例如,您可以在基本模块中设置 buildTypes.release.debuggable =
true
,而在功能模块中将其设置为 false
。此类冲突可能会导致构建和运行时问题。请注意,默认情况下,功能模块会从基本模块继承一些构建配置。因此,请务必了解在功能模块构建配置中应保留哪些配置以及应省略哪些配置。
其他资源
如需详细了解 Android App Bundle,请参阅以下资源。
博文
视频
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# About Android App Bundles\n\n| **Important:** From August 2021, new apps are required to publish with the [Android App Bundle](/guide/app-bundle) on Google Play. New apps larger than 200 MB are now supported by either [Play Feature Delivery](/guide/app-bundle/dynamic-delivery) or [Play Asset Delivery](/guide/app-bundle/asset-delivery). From June 2023, new and existing [TV apps are required to\n| be published as App Bundles](/docs/quality-guidelines/tv-app-quality#SC-E1).\n\nAn *Android App Bundle* is a publishing format that includes all your app's\ncompiled code and resources, and defers APK generation and signing to Google\nPlay.\n\nGoogle Play uses your app bundle to generate and serve optimized APKs for each\ndevice configuration, so only the code and resources that are needed for a\nspecific device are downloaded to run your app. You no longer have to build,\nsign, and manage multiple APKs to optimize support for different devices, and\nusers get smaller, more-optimized downloads.\n\nMost app projects won't require much effort to build app bundles that support\nserving optimized APKs. If you already [organize your app's code and\nresources](/guide/topics/resources/providing-resources#AlternativeResources)\naccording to established conventions, [build signed Android App\nBundles](/studio/publish/app-signing#sign-apk) using Android Studio or by [using\nthe command line](/studio/build/building-cmdline), and [upload them to Google\nPlay](/studio/publish/upload-bundle), then optimized APK serving becomes an\nautomatic benefit.\n\nWhen you use the app bundle format to publish your app, you can also optionally\ntake advantage of [Play Feature Delivery](/guide/playcore/feature-delivery),\nwhich lets you add *feature modules* to your app project.\nThese modules contain features and resources that are only included with your\napp based on conditions that you specify, or are available later at runtime for\ndownload [Using the Play Core Library](/guide/playcore).\n\nGame developers who publish their apps with app bundles can use\n[Play Asset Delivery](/guide/playcore/asset-delivery): Google Play's solution\nfor delivering large amounts of game assets that offers developers flexible\ndelivery methods and high performance.\n\nWatch the following video for an overview of why you should publish your app\nusing Android App Bundles. \n\nCompressed download size restriction\n------------------------------------\n\nPublishing with Android App Bundles helps your users to install your app with\nthe smallest downloads possible and increases the **compressed download size** .\nThat is, when a user downloads your app, the total size of\nthe compressed APKs required to install your app (for example, the base APK +\nconfiguration APKs) must be no more than 4 GB. Any subsequent downloads,\nsuch as downloading a feature module (and its configuration APKs) on demand,\nmust also meet this compressed download size restriction. Asset packs don't\ncontribute to this size limit, but they do have other [size restrictions](/guide/app-bundle/asset-delivery#size-limits).\n\nIf the Play Console finds any of the possible downloads of your app or its on\ndemand features to be more than the [maximum size limits](https://support.google.com/googleplay/android-developer/answer/9859372#size_limits), you will get an error.\n\nKeep in mind, **Android App Bundles do not support APK expansion (`*.obb`)\nfiles**. So, if you encounter this error when publishing your app bundle, use\none of the following resources to reduce compressed APK download sizes:\n\n- Make sure you [enable all configuration APKs](/studio/projects/dynamic-delivery#disable_config_apks) by setting `enableSplit = true` for each type of configuration APK. This makes sure that users download only the code and resources they need to run your app on their device.\n- Make sure you [shrink your app](/studio/build/shrink-code) by removing unused code and resources.\n- Follow best practices to further [reduce app size](/topic/performance/reduce-apk-size).\n- Consider converting features that are used by only some of your users into [feature modules](/studio/projects/dynamic-delivery#dynamic_feature_modules) that your app can download later, on demand. Keep in mind, this may require some refactoring of your app, so make sure to first try the other suggestions described.\n\nOther considerations\n--------------------\n\nThe following are known issues when building or serving your app\nwith Android App Bundles. If you experience issues that are\nnot already described here, [report a bug](https://issuetracker.google.com/issues/new?component=398856&template=1084213).\n\n- Partial installs of sideloaded apps---that is, apps that are not installed using the Google Play Store and are missing one or more required split APKs---fail on all Google-certified devices and devices running Android 10 (API level 29) or higher. When downloading your app through the Google Play Store, Google ensures that all required components of the app are installed.\n- If you use tools that dynamically modify resource tables, APKs generated\n from app bundles might behave unexpectedly. So, when building an app bundle,\n it is recommended that you disable such tools.\n\n- It is possible to configure properties in a feature\n module's build configuration that conflict with those from the base (or\n other) modules. For example, you can set `buildTypes.release.debuggable =\n true` in the base module and set it to `false` in a feature module.\n Such conflicts might cause build and runtime issues. Keep in mind, by default,\n feature modules inherit some build configurations from the base\n module. So, make sure you understand which configurations you should keep,\n and which ones you should omit, in your [feature module build\n configuration](/guide/app-bundle/configure#feature_build_config).\n\nAdditional resources\n--------------------\n\nTo learn more about Android App Bundles, consult the following resources.\n\n### Blog posts\n\n- [Building your first App Bundle](https://medium.com/androiddevelopers/building-your-first-app-bundle-bbcd228bf631)\n- [What a new publishing format means for the future of Android](https://medium.com/googleplaydev/what-a-new-publishing-format-means-for-the-future-of-android-2e34981793a)\n- [New features to help you develop, release, and grow your business on Google Play](https://android-developers.googleblog.com/2019/05/whats-new-in-play.html)\n- [The latest Android App Bundle updates including the additional languages API](https://android-developers.googleblog.com/2019/03/the-latest-android-app-bundle-updates.html)\n- [Patchwork Plaid --- A modularization story](https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e)\n- [Google Santa Tracker --- Moving to an Android App Bundle](https://medium.com/androiddevelopers/google-santa-tracker-moving-to-an-android-app-bundle-dde180716096)\n- [Developer tools on Play Console](https://medium.com/androiddevelopers/developer-tools-on-play-store-85fb710ee33b)\n\n### Videos\n\n- [Everything to know about Play App Signing](https://www.youtube.com/watch?v=odv_1fxt9BI)\n- [Building your first App Bundle](https://www.youtube.com/watch?v=IPLhLu0kvYw)\n- [App Bundles: Testing with Bundletool and the Play Console](https://www.youtube.com/watch?v=vAEAZPU7w-I)\n- [Customizable Delivery with the App Bundle and Easy Sharing of Test Builds](https://www.youtube.com/watch?v=flhib2krW7U)\n- [New Tools to Optimize Your App's Size and Boost Installs on Google Play](https://www.youtube.com/watch?v=rEuwVWpYBOY)"]]