Baseline Profiles (Android)
Emerge automatically generates a Baseline Profile file for your app, which can help improve code execution times by up to 30%.
Android-only feature
This is an Android-only feature. For iOS Launch Booster, see Order Files (iOS).
Overview
Baseline profiles instruct the Android Runtime to AOT (ahead of time) compile specific portions of an app's code upon installation or app update. AOT compiling commonly used portions of your app can significantly improve the application's runtime performance.
Baseline profiles are generated by running your app multiple times and recording what portions of your app are executed. This information is compiled into a baseline-prof.txt
file, which the Android Gradle Plugin will compress & bundle into your AAB or APK when building a release build.
Emerge takes all the heavy lifting of generating this profile off your hands and can make improving your app's performance as simple as executing a Gradle task.
Workflow (~5 minutes)
Generating a baseline profile is as simple as executing a single Gradle task included with version 1.1 of the Emerge Gradle Plugin.
Pre-requisite: Install the Emerge Gradle plugin (~5 minutes)
The Emerge Gradle plugin allows Emerge to produce a non-obfuscated build of your app and upload it directly to Emerge and trigger a generation of your baseline profile.
Follow the Gradle Plugin setup instructions before generating a baseline profile. You must set the appProjectPath
property to instruct Emerge where to download the generated baseline profile to.
1. Execute the emergeGenerateBaselineProfile
task
emergeGenerateBaselineProfile
taskWith a single Gradle task, Emerge will automatically generate a full baseline profile for the specific variant you specify. Emerge automatically generates this task for each non-debuggable variant of your application, allowing you to choose the proper variant/flavor to create a baseline profile from.
Simply run the following command, replacing variant with your desired build variant (i.e. release
).
./gradlew emergeGenerate{variant}BaselineProfile
Note: This task uploads an unobfuscated AAB to Emerge, which is required for generating a baseline profile.
Upon running the task, the Gradle plugin will upload your build and generate a baseline profile for the default, cold startup scenario.
Generation usually takes about 10 minutes or less, and you'll see output in your

The launch booster task will automatically download the generated Baseline Profile after ~10 minutes to /src/main/baseline-prof.txt of your app module.
2. Declare Profile Installer dependency
In order to load the baseline profile, make sure you have declared the Profile Installer on your app module.
dependencies {
implementation("androidx.profileinstaller:profileinstaller:1.2.1")
}
dependencies {
implementation 'androidx.profileinstaller:profileinstaller:1.2.1'
}
That's it!
Once moved into your project, you're good to go! Next time you generate a release build, the Android Gradle Plugin will automatically merge the Emerge generated
baseline-profile.txt
file with other baseline profiles provided by libraries, and bundle it into your release AAB or APK.For more details on measuring the improvements of Baseline Profiles, see Google's Baseline Profile measurement documentation.
Custom startup scenarios & flows
Emerge supports generating Baseline Profiles for custom startup scenarios and flows on a one-off basis.
Get in touch with our team through email or your team's dedicated Slack channel to set this up!
Disabling Launch Booster
Launch booster automatically creates custom variants for all non-debuggable variants of your app, allowing Emerge to configure the proper proguard/build settings on your behalf with no work or maintenance on your part.
If you wish to not have these variants generated automatically, you can disable Launch Booster with a Gradle property:
emerge {
...
launchBooster {
enabled.set(false)
}
}
emerge {
...
launchBooster {
enabled = false
}
}
Updated 9 days ago