I'm using Jetpack Compose. I have already used it and everything worked fine. I have configured Compose in the app module and in a feature module and in both modules I have imported the same library (see below). When I try to use it in another module, with the same configuration I get the error and all the solutions in here do not apply:
androidx.compose.compiler.plugins.kotlin.IncompatibleComposeRuntimeVersionException: You are using an outdated version of Compose Runtime that is not compatible with the version of the Compose Compiler plugin you have installed. The compose compiler plugin you are using (version 1.0.0-rc01) expects a minimum runtime version of 1.0.0-rc01. at androidx.compose.compiler.plugins.kotlin.VersionChecker.outdatedRuntimeWithUnknownVersionNumber(VersionChecker.kt:113) at androidx.compose.compiler.plugins.kotlin.VersionChecker.check(VersionChecker.kt:78) at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:57) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$convertToIr$1.invoke(JvmIrCodegenFactory.kt:120) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$convertToIr$1.invoke(JvmIrCodegenFactory.kt:116) at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:91) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:140) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr$default(JvmIrCodegenFactory.kt:66) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:61) at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
...
I have added the following sections in the build.gradle
file of the new module (as for the app module and the first module):
android {
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
composeOptions {
kotlinCompilerExtensionVersion Version.compose
kotlinCompilerVersion Version.kotlin
}
buildFeatures {
compose = true
}
}
dependencies {
implementation Compose.runtime
implementation Compose.composeActivity
implementation Compose.ui
implementation Compose.material
implementation Compose.uiTooling
implementation Compose.livedata
androidTestImplementation Compose.uiTest
}
where
object Version {
const val kotlin = "1.5.10"
const val compose = "1.0.0-rc01"
const val composeActivity = "1.3.0-rc01"
}
object Compose {
const val runtime = "androidx.compose.runtime:runtime:${Version.compose}"
const val composeActivity = "androidx.activity:activity-compose:${Version.composeActivity}"
const val ui = "androidx.compose.ui:ui:${Version.compose}"
const val material = "androidx.compose.material:material:${Version.compose}"
const val uiTooling = "androidx.compose.ui:ui-tooling:${Version.compose}"
const val uiTest = "androidx.compose.ui:ui-test-junit4:${Version.compose}"
const val livedata = "androidx.compose.runtime:runtime-livedata:${Version.compose}"
}
The second module in which I'm trying to add Jetpack Compose has many more dependencies. Is it possible that the issue is with one of the dependencies?