I’m trying to optimize the performance of my Jetpack Compose UI by enabling Strong Skipping mode. I’ve read about the benefits of this mode, but I’m unsure how to actually enable it in my project. my gradle files are in Groovy Not in kts
I added this to my app/build.gradle file
android { ... }
composeCompiler {
enableStrongSkippingMode = true
}
when i sync the project i’m getting the following gradle error
A problem occurred evaluating project ':app'.
> Could not find method composeCompiler() for arguments [build_duzdc886dgg5uy4aejl1ily6m$_run_closure6@4fe2ec36] on project
-----------------------
root/build.gradle
buildscript {
kotlinVersion = "1.9.24"
composeBOMVersion = "2024.06.00"
composeCompilerVersion = "1.5.14"
dependencies {
classpath 'com.android.tools.build:gradle:8.5.1'
classpath 'com.google.gms:google-services:4.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath("com.google.firebase:firebase-crashlytics-gradle:3.0.2")
}
}
subprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:stabilityConfigurationPath=" +
project.absolutePath + "/compose_compiler_config.conf"
]
if (project.findProperty("composeCompilerReports") == "true") {
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_compiler"
]
}
if (project.findProperty("composeCompilerMetrics") == "true") {
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_compiler"
]
}
}
}
}
-----------------------
app/build.gradle
android {
...
compileSdk rootProject.ext.compileSdkVersion
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = "${composeCompilerVersion}"
}
...
}
composeCompiler {
enableStrongSkippingMode = true
}