Giới thiệu về Android App Bundle
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Android App Bundle là định dạng xuất bản chứa tất cả tài nguyên và mã đã biên dịch của ứng dụng, đồng thời trì hoãn việc tạo tệp APK và đăng nhập vào Google Play.
Google Play sử dụng gói ứng dụng của bạn để tạo và phân phát tệp APK được tối ưu hoá cho từng cấu hình thiết bị. Do đó, chỉ đoạn mã và tài nguyên cần thiết cho một thiết bị cụ thể mới được tải xuống để chạy ứng dụng của bạn. Bạn không còn phải xây dựng, ký và quản lý nhiều tệp APK để tối ưu hoá khả năng hỗ trợ cho nhiều thiết bị, đồng thời người dùng sẽ nhận được các tệp tải xuống nhỏ hơn và được tối ưu hoá nhiều hơn.
Hầu hết các dự án ứng dụng đều không cần nhiều nỗ lực để xây dựng gói ứng dụng hỗ trợ việc phân phát tệp APK được tối ưu hoá. Nếu bạn đã sắp xếp mã và tài nguyên của ứng dụng theo các quy ước đã thiết lập, hãy tạo Android App Bundle đã ký bằng Android Studio hoặc sử dụng dòng lệnh và tải chúng lên Google Play, thì việc phân phát APK được tối ưu hoá sẽ trở thành một lợi ích tự động.
Khi sử dụng định dạng gói ứng dụng để phát hành ứng dụng, bạn cũng có thể tuỳ ý tận dụng Play Feature Delivery để thêm mô-đun tính năng vào dự án ứng dụng của mình.
Các mô-đun này chứa các tính năng và tài nguyên chỉ đi kèm với
ứng dụng căn cứ theo các điều kiện bạn chỉ định hoặc có thể sử dụng về sau vào thời gian chạy khi
tải xuống Sử dụng Thư viện Play Core.
Các nhà phát triển trò chơi phát hành ứng dụng bằng gói ứng dụng có thể sử dụng Play Asset Delivery: Giải pháp của Google Play để phân phối số lượng lớn tài sản trò chơi qua đó cung cấp cho nhà phát triển phương thức phân phối linh hoạt và mang lại hiệu suất cao.
Hãy xem video sau đây để biết thông tin tổng quan về lý do bạn nên phát hành ứng dụng của mình
bằng Android App Bundle.
Hạn chế về kích thước tệp nén tải xuống
Việc xuất bản bằng Android App Bundle giúp người dùng của bạn cài đặt ứng dụng với các tệp tải xuống nhỏ nhất có thể và tăng kích thước tệp nén tải xuống.
Nghĩa là, khi người dùng tải ứng dụng xuống, tổng kích thước của tệp APK nén cần thiết để cài đặt ứng dụng (ví dụ: APK cơ sở + APK cấu hình) không được vượt quá 4 GB. Mọi lượt tải xuống tiếp theo, chẳng hạn như tải một mô-đun tính năng (và APK cấu hình của mô-đun đó) xuống theo yêu cầu, cũng phải đáp ứng giới hạn kích thước tệp nén tải xuống này. Gói tài sản không đóng góp vào giới hạn kích thước này, nhưng có giới hạn kích thước khác.
Nếu Play Console nhận thấy bất kỳ tệp tải xuống nào có thể của ứng dụng hoặc tính năng theo yêu cầu của ứng dụng vượt quá giới hạn kích thước tối đa, thì bạn sẽ gặp lỗi.
Xin lưu ý rằng Android App Bundle không hỗ trợ tệp mở rộng APK (*.obb
). Do đó, nếu bạn gặp lỗi này khi phát hành gói ứng dụng, hãy sử dụng
một trong các tài nguyên sau để giảm kích thước tải xuống của tệp APK nén:
- Đảm bảo bạn bật tất cả các tệp APK cấu hình bằng cách đặt
enableSplit = true
cho từng loại APK cấu hình. Điều này giúp đảm bảo rằng
người dùng chỉ tải mã và tài nguyên họ cần xuống để chạy ứng dụng của bạn
trên thiết bị của họ.
- Đảm bảo bạn thu gọn kích thước ứng dụng bằng cách loại bỏ mã
và tài nguyên không sử dụng.
- Hãy làm theo các phương pháp hay nhất để tiếp tục
giảm kích thước cho ứng dụng.
- Cân nhắc chuyển đổi các tính năng mà chỉ một số người dùng của bạn sử dụng thành
mô-đun tính năng
mà ứng dụng có thể tải xuống sau theo yêu cầu. Xin lưu ý rằng có thể bạn sẽ phải tái cấu trúc một số ứng dụng, vì vậy, hãy nhớ thử những đề xuất khác như mô tả.
Lưu ý khác
Sau đây là các vấn đề đã biết khi tạo hoặc phân phát ứng dụng bằng Android App Bundle. Nếu bạn gặp các vấn đề chưa được mô tả ở đây, hãy báo cáo lỗi.
- Việc cài đặt một phần của ứng dụng đã tải không qua cửa hàng — nghĩa là, ứng dụng không được cài đặt bằng Cửa hàng Google Play và bị thiếu một hoặc nhiều tệp APK phân tách cần thiết — không thành công trên tất cả thiết bị được Google chứng nhận và thiết bị chạy Android 10 (API cấp 29) trở lên. Khi tải ứng dụng của bạn xuống thông qua Cửa hàng Google Play, Google
đảm bảo rằng tất cả các thành phần bắt buộc của ứng dụng đều được cài đặt.
Nếu bạn sử dụng các công cụ sửa đổi linh hoạt bảng tài nguyên, thì các tệp APK được tạo ra từ
gói ứng dụng có thể sẽ hoạt động không như dự kiến. Vì vậy, khi tạo gói ứng dụng, bạn nên tắt các công cụ như vậy.
Bạn có thể định cấu hình các thuộc tính trong cấu hình xây dựng của mô-đun tính năng xung đột với thuộc tính từ mô-đun cơ sở (hoặc mô-đun khác). Ví dụ: bạn có thể đặt buildTypes.release.debuggable =
true
trong mô-đun cơ sở và đặt nó thành false
trong mô-đun tính năng.
Những xung đột như vậy có thể gây ra vấn đề về bản dựng và thời gian chạy. Xin lưu ý rằng, theo mặc định,
các mô-đun tính năng sẽ kế thừa một số cấu hình xây dựng từ mô-đun
cơ sở. Vì vậy, hãy đảm bảo bạn nắm được cấu hình nào nên giữ lại
và cấu hình nào nên bỏ qua trong cấu hình
xây dựng mô-đun tính năng.
Tài nguyên khác
Để tìm hiểu thêm về Android App Bundle, hãy tham khảo các tài nguyên sau.
Bài đăng trên blog
Video
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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)"]]