Create Startup Profiles

Startup Profiles are a subset of Baseline Profiles. Startup Profiles are used by the build system to further optimize the classes and methods they contain by improving the layout of code in your APK's DEX files. With Startup Profiles, your app startup is at least 15% faster than with Baseline Profiles alone.

Figure 1. Code locality improvement from DEX layout optimization.


We recommend using Startup Profiles with the following tools:

  • Jetpack Macrobenchmark 1.2.0 or higher
  • Android Gradle Plugin 8.2 or higher
  • Android Studio Iguana or higher

In addition, you need the following settings:

  • R8 enabled. For your release build, set isMinifyEnabled = true.
  • DEX layout optimizations enabled. In the baselineProfiles {} block of the test module's build file, set dexLayoutOptimization = true.

Create a Startup Profile

Android Studio creates a Startup Profile alongside a Baseline Profile when you use the default Baseline Profile Generator template.

The general steps to create and generate a Startup Profile are the same as those to create a Baseline Profile.

The default way to create a Startup Profile is by using the Baseline Profile Generator module template from within Android Studio. This includes startup interactions that form a basic Startup Profile. To augment this Startup Profile with more Critical User Journeys (CUJs), add your app startup CUJs to a rule block with includeInStartupProfile set to true. For simple apps, launching the app's MainActivity might be sufficient. For more complex apps, consider adding the most common entry points into your app, such as starting the app from the home screen or launching into a deep link.

The following code snippet shows a Baseline Profile generator (by default the BaselineProfileGenerator.kt file) that includes starting your app from the home screen and launching into a deep link. The deep link goes directly to the app's news feed, not the app's home screen.

class BaselineProfileGenerator {

    val rule = BaselineProfileRule()

    fun generate() {
            packageName = "",
            includeInStartupProfile = true
        ) {
            // Launch directly into the NEWS_FEED.
            startActivityAndWait(Intent().apply {

Run the Generate Baseline Profile for app configuration and find the Startup Profile rules at src/<variant>/generated/baselineProfiles/startup-prof.txt.