關於 Android App Bundle
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android App Bundle 是一種發布格式,其中包含應用程式的所有編譯程式碼和資源,可將產生及簽署 APK 的作業交由 Google Play 處理。
Google Play 會使用應用程式套件,為各種裝置設定產生及提供最合適的 APK,因此執行應用程式時,只會下載特定裝置所需的程式碼和資源。如此一來,您就不必再為了提供最適合各裝置的支援功能,建構、簽署及管理多個 APK。此外,使用者也能取得較小且經過最佳化的下載內容。
大多數的應用程式專案都能輕鬆建構支援提供最佳化 APK 的應用程式套件。如果您已按照既定慣例整理應用程式的程式碼和資源,請使用 Android Studio 或使用指令列建構已簽署的 Android App Bundle,然後上傳至 Google Play,這樣最佳化的 APK 提供功能就會成為自動優勢。
使用應用程式套件格式發布應用程式時,您也可以選擇善加利用 Play Feature Delivery,在應用程式專案中加入功能模組。這些模組包含的功能和資源只會依您指定的條件納入應用程式,或於之後的執行階段使用 Play Core 程式庫下載。
使用應用程式套件發布應用程式的遊戲開發人員可以使用 Play Asset Delivery:Google Play 的解決方案提供大量遊戲資產,讓開發人員享有靈活的提交方式和高效能。
請觀看以下影片,概略瞭解使用 Android App Bundle 發布應用程式的原因。
壓縮下載大小限制
使用 Android App Bundle 發布應用程式,有助於使用者以盡可能少的下載量安裝您的應用程式,並提高壓縮下載大小。也就是說,使用者下載應用程式時,安裝應用程式的壓縮 APK 大小 (例如基準 APK + 設定 APK) 不得超過 4 GB。後續的所有下載作業 (例如隨選下載功能模組及其設定 APK) 也必須符合這個壓縮下載大小限制。資產包不適用於這個大小限制,但其有其他大小限制。
如果 Play 管理中心發現任一應用程式下載作業或隨選功能超出大小上限,就會收到錯誤訊息。
請注意,Android App Bundle 不支援 APK 擴充檔案 (*.obb
) 檔案。因此,如果您在發布應用程式套件時遇到這個錯誤,請使用下列資源縮減壓縮的 APK 下載大小:
- 請務必為每種設定 APK 設定
enableSplit = true
,藉此啟用所有設定 APK。確保使用者只下載在裝置上執行應用程式所需的程式碼和資源。
- 請務必移除未使用的程式碼和資源,藉此縮減應用程式。
- 按照最佳做法進一步縮減應用程式大小。
- 請考慮將只有部分使用者會使用的功能轉換為功能模組,方便應用程式日後隨選下載。請注意,這可能需要重構應用程式,因此請務必先嘗試上述其他建議。
其他考量
以下是使用 Android App Bundle 建構或提供應用程式時的已知問題。如果您遇到此處未提及的問題,請回報錯誤。
- 側載的應用程式進行部分安裝 (也就是未透過 Google Play 商店安裝,且缺少一或多個必要的分割 APK) 在所有 Google 認證裝置和搭載 Android 10 (API 級別 29) 以上版本的裝置上均無法執行。透過 Google Play 商店下載應用程式時,Google 會確保已安裝應用程式的所有必要元件。
如果您使用的工具會動態修改資源資料表,從應用程式套件產生的 APK 可能會發生非預期的行為。因此,建議您在建立應用程式套件時停用這類工具。
您可以在功能模組的建構設定中設置與基本 (或其他) 模組衝突的屬性。舉例來說,您可以在基本模組中設定 buildTypes.release.debuggable =
true
,然後在功能模組中將其設為 false
。這類衝突可能會導致建構和執行階段問題。請注意,根據預設,功能模組會繼承基本模組中的部分建構設定。因此,請務必瞭解功能模組建構設定中應保留哪些設定,以及應省略哪些設定。
其他資源
如要進一步瞭解 Android App Bundle,請參閱下列資源。
網誌文章
影片
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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)"]]