Application to test baselineprofile library under a clean library install
Guide
Run the following command to generate the baseline-prof.txt file.
./gradlew :app:generateReleaseBaselineProfile -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
The generated file will be found under build package of baselineprofile module.
Go to outputs then to connected_android_test_additional_output folder and look for the device used on tests. It's the one ending
with prof.txt.
Put this file inside main app package with Android Manifest and rename it to baseline-prof.txt.
Run the following command to collect application startup and journeys metrics.
./gradlew :baselineprofile:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=Macrobenchmark
Discoveries
- We don't need
macrobenchmarklibrary import, justbaselineprofileandprofileinstaller. - BaselineProfile needs his own module, like
macrobenchmark. - Using alpha versions of
baselineprofilelibrary allows run baseline generating tasks without rooted physical devices. - Maybe it's necessary upgrade gradle to 8.0.0 or above versions.
- BaselineProfile library already contains
macrobenchmarkjetpack library. The opposite is not true.
Recommended libraries versions

Compilation behavior across Android Versions

Results running Baseline Profile on this app:

Success cases of Baseline Profile use
- https://developer.android.com/stories/apps/tiktok
- https://developer.android.com/stories/apps/lyft
- https://developer.android.com/stories/apps/zomato
- https://developer.android.com/stories/apps/josh
Baseline Profile documentation
