Android: App bundle standalone APK is larger than regular APK |
||
Issue descriptionWhen using a CL like https://chromium-review.googlesource.com/c/chromium/src/+/1071657 to generate an App Bundle instead of a regular APK (i.e. building chrome_public_bundle_apks instead of chrome_public_apk), the .apks archive contains a standalone APK which is considerably larger than the regular APK, i.e.: ChromePublic.apk -> 48740582 bytes. standalone.apk -> 48931775 bytes. Looking at the content of the APK shows that they are equal, except that each and every compiled xml file within standalone.apk is larger than its corresponding counterpart in ChromePublic.apk. The resources.arsc also has a different (slightly larger size): These compiled xml resources are built using a very new version of the 'aapt2' tool, unlike those that are built for ChromePublic.apk (which still use the 'aapt2' version of Android SDK Build Tools 27.0.3 at the current time). A simple change (overwriting all 'aapt2' binaries in the Chromium checkout with the newest version), shows that a newly built ChromePublic.apk has identical content, except for a larger resources.arsc file (i.e. the compiled xml resources are the same)! So it looks like that: - Newest aapt2 binaries produce larger resources.arsc files. - Compiling resources to protobuf format (for bundles) then into split apk resources (through bundletool build-apks), generates larger For reference, resulting binaries are available inside Google from /google/data/ro/users/di/digit/www/chrome-bundles/size-comparison I've added text dumps of AndroidManifest.xml and resources.arsc as well: ..../size-comparison ├── [ 4096] bundle_standalone_apk │ ├── [ 178712] AndroidManifest.xml.txt │ ├── [ 48931775] ChromePublic.apk │ └── [ 8607172] resources.txt ├── [ 4096] regular │ ├── [ 157233] AndroidManifest.xml.txt │ ├── [ 48740582] ChromePublic.apk │ └── [ 8607172] resources.txt └── [ 4096] regular_newest_aapt2 ├── [ 157233] AndroidManifest.xml.txt ├── [ 48742177] ChromePublic.apk └── [ 8607172] resources.txt This entry is to track the issue.
,
Jun 22 2018
For what is worse, the difference in a file like AndroidManifest.xml is the presence of "(Raw: "<something>")" in the text output: diff -burN regular/AndroidManifest.xml.txt bundle_standalone_apk/AndroidManifest.xml.txt @@ -1,15 +1,15 @@ N: android=http://schemas.android.com/apk/res/android E: manifest (line=2) - A: android:versionCode(0x0101021b)=(type 0x10)0x1 + A: android:versionCode(0x0101021b)=(type 0x10)0x1 (Raw: "1") A: android:versionName(0x0101021c)="Developer Build" (Raw: "Developer Build") A: package="org.chromium.chrome" (Raw: "org.chromium.chrome") - A: platformBuildVersionCode=(type 0x10)0x1b + A: platformBuildVersionCode=(type 0x10)0x1b (Raw: "27") A: platformBuildVersionName="8.1.0" (Raw: "8.1.0") E: uses-sdk (line=3) - A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10 - A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1b + A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10 (Raw: "16") + A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1b (Raw: "27") E: uses-feature (line=5) - A: android:glEsVersion(0x01010281)=(type 0x11)0x20000 + A: android:glEsVersion(0x01010281)=(type 0x11)0x20000 (Raw: "0x00020000") E: uses-permission (line=7) A: android:name(0x01010003)="android.permission.ACCESS_COARSE_LOCATION" (Raw: "android.permission.ACCESS_COARSE_LOCATION") E: uses-permission (line=8) @@ -64,33 +64,33 @@ A: android:name(0x01010003)="android.permission.WRITE_SYNC_SETTINGS" (Raw: "android.permission.WRITE_SYNC_SETTINGS") E: uses-feature (line=40) A: android:name(0x01010003)="android.software.vr.mode" (Raw: "android.software.vr.mode") - A: android:required(0x0101028e)=(type 0x12)0x0 + A: android:required(0x0101028e)=(type 0x12)0x0 (Raw: "false") E: uses-feature (line=42) A: android:name(0x01010003)="android.hardware.vr.high_performance" (Raw: "android.hardware.vr.high_performance") - A: android:required(0x0101028e)=(type 0x12)0x0 + A: android:required(0x0101028e)=(type 0x12)0x0 (Raw: "false") E: uses-feature (line=44) A: android:name(0x01010003)="android.hardware.screen.landscape" (Raw: "android.hardware.screen.landscape") - A: android:required(0x0101028e)=(type 0x12)0x0 + A: android:required(0x0101028e)=(type 0x12)0x0 (Raw: "false") E: uses-feature (line=46) A: android:name(0x01010003)="android.hardware.vr.headtracking" (Raw: "android.hardware.vr.headtracking") - A: android:required(0x0101028e)=(type 0x12)0x0 - A: android:version(0x01010519)=(type 0x10)0x1 + A: android:required(0x0101028e)=(type 0x12)0x0 (Raw: "false") + A: android:version(0x01010519)=(type 0x10)0x1 (Raw: "1") E: permission (line=48) etc.
,
Jun 22 2018
what is worth... damn.
,
Sep 11
,
Dec 18
It turns out that this is due to the fact that aapt2 was copying the raw version of each resource into the final output. This is being addressed internally through b/115915884, and will require a new version of the tool to fix. |
||
►
Sign in to add a comment |
||
Comment 1 by agrieve@chromium.org
, Jun 22 2018