I'm using Android Studio for Android development with Kotlin. I have more than 40 Android modules in the project: some of them are Java module, some of theme are android module.
Kotlin Version = "1.8.20"
Hilt Version = "2.45"
Compose BOM Version = "2023.01.00"
Compose Compiler Version = "1.4.3"
com.android.library = "7.4.1"
com.android.application = "7.4.1"
I want to run Compose Metrics Considering the following:
buildscript {
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
id 'com.google.dagger.hilt.android' version '2.45' apply false
}
subprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
if (project.findProperty("myapp.enableComposeCompilerReports") == "true") {
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
]
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
]
}
}
}
}
But I see an error as follows:
Multiple values are not allowed for plugin option androidx.compose.compiler.plugins.kotlin:reportsDestination
Plugin "androidx.compose.compiler.plugins.kotlin" usage:
liveLiterals <true|false> Enable Live Literals code generation
liveLiteralsEnabled <true|false>
Enable Live Literals code generation (with per-file enabled flags)
generateFunctionKeyMetaClasses <true|false>
Generate function key meta classes with annotations indicating the functions and their group keys. Generally used for tooling.
sourceInformation <true|false>
Include source information in generated code
metricsDestination <path> Save compose build metrics to this folder
reportsDestination <path> Save compose build reports to this folder
intrinsicRemember <true|false>
Include source information in generated code
suppressKotlinVersionCompatibilityCheck <true|false>
Suppress Kotlin version compatibility check
generateDecoys <true|false>
Generate decoy methods in IR transform
In another simple project this problem came when I added Hilt
Update:
If you add the kapt plugin you'll run into this issue.
Add id 'org.jetbrains.kotlin.kapt' version '1.8.10' apply false
to the top-level build.gradle
Add id 'org.jetbrains.kotlin.kapt'
to the app's build.gradle
Run ./gradlew assembleDebug -Pmyapp.enableComposeCompilerReports=true
And the issue will reproduce without any Hilt dependencies added.
Update:
If you migrate your gradle files to kts and (use version catalog and plugin convention). I think your problem will be solved