Repository navigation
Add R8 minification and baseline/startup profiles to Android - #11
Merged
Merged
Conversation
- Update AGP to 9.4.1, Gradle to 9.8.1, Kotlin to 2.4.21, Compose Multiplatform to 1.12.2 and all libraries to latest stable. - Migrate :common and :storage to com.android.kotlin.multiplatform.library (required by AGP 9), use built-in Kotlin in :android, and move Room KSP to kspAndroid. Drop the iosX64 target (unsupported by Compose 1.12). - Bump compileSdk to 37 (required by updated libraries); targetSdk stays 36. - Migrate kotlinx.datetime.Clock to kotlin.time.Clock. - Enable R8 and resource shrinking for release. - Add :baselineprofile module with a generator that also emits a startup profile, plus startup macrobenchmarks. Add ReportDrawn and content descriptions on the settings/new game icons. - Generate profiles on CI with a Gradle Managed Device emulator and feed them into the APK and AAB builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Turns on R8 for the Android release build and adds baseline and startup profiles that are generated on CI. Also updates AGP and all libraries, since AGP 9 is needed for the profile tooling.
Results (release build, measured on a physical S6003L, API 31)
Cold startup, median of 10 runs:
Changes
Build updates
:commonand:storagenow usecom.android.kotlin.multiplatform.library. AGP 9 no longer allows KMP together withcom.android.library.:androiduses AGP's built-in Kotlin instead ofkotlin("android").ksptokspAndroid, which matches what it generated before.iosX64target is removed because Compose 1.12 no longer publishes it.kotlinx.datetime.Clock→kotlin.time.Clock, and an opt-in forDeferredTargetAnimation(now stable) is removed.ui-test-junit4-androidfrom the app's runtime dependencies. Nothing used it, and it was shipping in the APK.Minification
isMinifyEnabledandisShrinkResourceson, usingproguard-android-optimize.txt.proguard-rules.prois empty because R8 reported no missing keep rules.Profiles
:baselineprofilemodule.BaselineProfileGeneratorplays a short game (draw, Auto Move, Undo, Settings drawer, New Game) and emits both a baseline profile and a startup profile. The startup profile drivesdexLayoutOptimization.StartupBenchmarkscompares cold startup with no compilation against cold startup with the profile required.ReportDrawn()is added inMainActivityso time to full display is measured. The Settings and New Game icon buttons get content descriptions, which the test uses and screen readers benefit from.<profileable android:shell="true">is added to the manifest.CI
baselineProfilejob runs on a Gradle Managed Device (Pixel 6, API 34, AOSP image) with KVM. It uploads the generated profiles as an artifact.aabandapkjobs now depend on that job and download the fresh profiles before building. The committed profiles inandroid/src/release/generated/baselineProfiles/are the local fallback.Testing
:desktopJVM and:commonwasm targets compile.iosMainstill fails to compile, as it did before: its dependency onstorageis commented out.Notes
.github/**and only runs on pushes tomaster, so this PR doesn't trigger it. Use Run workflow on this branch to try it before merging..gitignorealso contains a.hotswan/entry that was already uncommitted in the working tree.🤖 Generated with Claude Code