Introduction to the
The Android App Bundle is a publishing format that contains all of your App’s compiled code and resources and hands over APK generation and signing to Google Play. Google Play uses your App Bundle to generate and provide an optimized APK for each device configuration, so it only downloads the code and resources needed for that particular device to run your app. You no longer have to build, sign, and manage multiple APKs to optimize support for different devices, and users can get smaller and more optimized download packages. More details please check developer.android.com/guide/app-b…
use
1. Build the App Bundle
Since the App Bundle is a distribution format developed by Google, Google has integrated the method of building the App BundleAndroid studioBuilding the App Bundle using Android Studio (Android Sudio 3.2 or later) is done in a few simple steps.
1. Click on the Build
2. Select Generate Signed Bundle/APK
3. Select the Android App Bundle option and click NEXT
4. Select the signature file, enter the password, and click NEXT
(on the Export in this picture the function of the encrypted key options please see developer.android.com/studio/publ…).
5. Select the version you want to build, click FINISH, and Android Studio starts building app Bunle
At this point, we’re done building the Android App Bundle.
Note:The confused mapping file for creating the Android App Bundle will also be in there. The following figureThis figure shows the obfuscated mapping file found when the Android App Bundle is decompressed
Remove Android App Bundle confusion mapping files
The Android App Bundle contains observed-mapping files, but sometimes we don’t want to give out observed-mapping files. We can use AabResGuard to remove observed-mapping files.
1. First we need the AabResGuard tool, which can be downloaded on Github.
2. With AabResGuard, we can use this tool to filter out confused mapping files from Android App Bundle and regenerate Android App Bundle.
3. Because filtering must have rules, we create a “config. XML “configuration file and configure filtering rules as follows:
<? The XML version = "1.0" encoding = "utf-8"? > <resproguard> <filter isactive="true"> <rule value="BUNDLE-METADATA/**/proguard.map" /> </filter> </resproguard>Copy the code
Isactive: Indicates whether to enable it
4. Run the following command to filter out the obfuscated mapping files and recreate the Android App Bundle:
Jar filter-file --bundle=E:\app-flavorRlease-release.aab --output=filtered. Aab --config=E:\config.xml --storeFile=E:\aaaa.jks --storePassword=123456 --keyAlias=aaaa --keyPassword=123456 java -jar (aabresguard-0.1.8.jar tool path) filter-file --bundle=(Android App bundle. aab file path) --output=(Android App bundle. aab file path and file name) --config= (config.xml configuration XML file path) --storeFile=(application signature path) --storePassword=(password) --keyAlias=(alias) --keyPassword=(password)Copy the code
This removes the obfuscated mapping files from the Android App Bundle.
test
We have completed the construction of Android App Bundle but have not tested the APK produced using Android App Bundle. Therefore, it is still not safe to submit the Android App Bundle to Google Play for distribution. So you need to test it
Let’s talk about how to test locally. 1. First we need the Bundletool tool, which can be downloaded on Github.
Bundletool generates apKs from Android App Bundles using the bundletool command: bundletool
Java-jar E:\bundletool-all-1.4.0.jar build-apks --bundle=app-flavor1-release.aab --output=app-flavor1-release.apks --ks= aaa. JKS --ks-pass=pass:123456 --ks-key-alias=aaaa --key-pass=pass:123456 java-jar (Bundletool directory) build-apks --bundle=(Android App bundle. aab file path) --output=(apKS generated path and name) --ks=(App signature path) --ks-pass=pass (password) --ks-key-alias=(alias) - key - pass = pass: (password)Copy the code
Only the –bundle and –output names above are required. You don’t need to set the application signature tag. When the application signature tag is not set, Bundletool will try to sign the APK using the debug key. Thus generate the APK collection, why is the set APK, because Android App Bundle format according to a specific reasons please see the link developer.android.com/guide/app-b…
3. Install APK on the mobile phone using Bundletool and run the following command to install it:
Java -jar E:\bundletool-all-1.4.0.jar install-apks --apks=app-flavor1-release.apks java-jar (bundletool -jar) Install -apks --apks=(apks file path)Copy the code
This completes generating the APK from the Android App Bundle and installing it on the phone.
“
Here is simply to use the bundletool tool set can go to the following link to see more developer.android.com/studio/comm…
Here only in detail the local test methods, there are other testing methods, to learn can go to the following link to see developer.android.com/guide/app-b…
This is a simple use of the AabResGuard tool’s filtering capabilities, as well as other features, which can be found at github.com/bytedance/A…