build-logic: uncompress dex and jni libs for system prebuilts
- Commit
f891b8bde1c3669fcf2e4fa7dd1631f580950d31- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-06 03:26 UTC (3 months ago)
- Parents
9539e6d
Diff
build-logic/src/main/kotlin/common-conventions-app.gradle.kts
diff --git a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts b/build-logic/src/main/kotlin/common-conventions-app.gradle.ktsindex c5fdfa27b3..1f6b521f36 100644--- a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts+++ b/build-logic/src/main/kotlin/common-conventions-app.gradle.kts@@ -218,19 +218,22 @@ configure<com.android.build.api.dsl.ApplicationExtension> { "META-INF/NOTICE.md", ) }- // AGP defaults both of these to false, which stores .so and .dex entries- // uncompressed so the platform can mmap them straight out of the APK. That- // trade is right for Play, which ships app bundles and compresses on the- // wire anyway. These apps are distributed as bare APKs through :appstore,- // where the stored bytes _are_ the download, and native code plus dex is- // the bulk of every APK here (dex ~236 MB and .so ~165 MB across the repo,- // both roughly halving under deflate). Cost is install size and a slower- // first launch, since the libs now get extracted.+ // Left at the AGP default (false), which stores .so and .dex uncompressed so the+ // platform can mmap them straight out of the APK. MAOS ships these same APKs as+ // presigned prebuilts in the system image, and Soong requires `preprocessed: true`+ // for a presigned prebuilt targeting SDK >= 30 (otherwise it would re-zipalign and+ // wreck the v2 signature). A preprocessed APK is installed byte-for-byte, so Soong+ // rejects any compressed .so, and any compressed dex in a priv-app.+ //+ // This costs download size on :appstore, where the stored bytes _are_ the download+ // and native code plus dex is the bulk of every APK (dex ~236 MB and .so ~165 MB+ // across the repo, both roughly halving under deflate). It buys back install size+ // and first-launch time, since the libs no longer get extracted. jniLibs {- useLegacyPackaging = true+ useLegacyPackaging = false } dex {- useLegacyPackaging = true+ useLegacyPackaging = false } } }