https://kotlinlang.org logo
#compose
Title
# compose
p

Pavel Ratushnyi

08/31/2020, 6:48 AM
Hi all I have an issue trying to add Compose to my project When building project i get this error:
Copy code
e: 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 0.1.0-dev16) expects a minimum runtime version of 0.1.0-dev16.
But i specify in build.gradle for 2 modules (feature module when i want to use compose and app module) latest version of compose:
Copy code
android {

    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerVersion '1.4.0'
        kotlinCompilerExtensionVersion '1.0.0-alpha01'
    }

    kotlinOptions {
        jvmTarget = jvmTargetVer
        useIR = true
    }
}
I use gradle plugin version 4.2.0-alpha08:
Copy code
classpath 'com.android.tools.build:gradle:4.2.0-alpha08'
and gradle version 6.6:
Copy code
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
and kotlin version 1.4.0:
Copy code
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
Could anyone help me please? What i'm doing wrong?
j

jim

08/31/2020, 7:43 AM
Try doing a global search for
dev16
and replace that with
alpha01
. It seems likely you've got a lingering reference to
dev16
in one of your gradle files.
p

Pavel Ratushnyi

08/31/2020, 7:59 AM
i tried to do this, but i am sure that i do not specify version
dev16
nowhere explicitly maybe it is used somewhere implicitly
z

Zhelyazko Atanasov

08/31/2020, 10:03 AM
What version of Android Studio do you use?
p

Pavel Ratushnyi

08/31/2020, 10:13 AM
4.2 Canary 8
p

ppvi

08/31/2020, 12:55 PM
invalidate caches?
z

Zhelyazko Atanasov

08/31/2020, 2:06 PM
Have you set the compiler args? e.g:
Copy code
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
        // Opt-in to experimental compose APIs
        freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
    }
}
p

Pavel Ratushnyi

09/01/2020, 6:54 AM
tried to add the snippet above, then clean the project, invalidate caches and restart, and then rebuild project but have the same issue can it be related to multimodule project? because for now, a have added compose only to two modules (feature module and app module). maybe i should add compose to all the modules?
3 Views