I cannot get my project to compile after upgrading to compose beta-01. When searching for "alpha-13" in my project I cannot find something too, which is really weird. It worked with alpha-12 though. Im running the correct Android Studio (Arctic Fox Canary 8 at the time)
Invalidate Caches restart, clean project and cleaned global cache does not work
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-alpha13) expects a minimum runtime version of 1.0.0-alpha13.
at androidx.compose.compiler.plugins.kotlin.VersionChecker.outdatedRuntimeWithUnknownVersionNumber(VersionChecker.kt:102)
at androidx.compose.compiler.plugins.kotlin.VersionChecker.check(VersionChecker.kt:67)
at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:44)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$generateModule$1.invoke(JvmIrCodegenFactory.kt:93)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$generateModule$1.invoke(JvmIrCodegenFactory.kt:89)
at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:91)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:106)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:595)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:211)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:154)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:386)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:110)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:286)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:99)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:114)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:74)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1659)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Compose works by transforming all Kotlin functions that are annotated with @Composable and adding code for the Compose Runtime. To do that it uses a Kotlin Compiler Plugin.
To downgrade the plugin, you need to uninstall it, download the 1.0. 6 version corresponding to your IDE version as a file from plugins.jetbrains.com and install it using the “Install plugin from disk” button. The lack of support for downgrading plugins is a limitation of the IntelliJ Platform at this time.
You can check the Kotlin version in Tools | Kotlin | Configure Kotlin Plugin Updates. If you have projects created with earlier Kotlin versions, change the Kotlin version in your projects and update kotlinx libraries if necessary – check the recommended versions.
Jetpack Compose is Android's modern toolkit for building native UI. It simplifies and accelerates UI development on Android bringing your apps to life with less code, powerful tools, and intuitive Kotlin APIs. It makes building Android UI faster and easier.
The Compose Compiler now supports older versions of the Compose Runtime (1.0). Prior to this change, the Compose Compiler was only compatible with the Compose Runtime of the same version or later. After this change, the Compose Compiler is compatible with an older version of the Compose Runtime (1.0). (aosp/1796968)
Version 1.0.0-alpha04 contains these commits. Note: Compose Version 1.0.0-alpha04 is only compatible with Android Studio 4.2 Canary 13 and later. Added OwnerScope to allow collection of layout and drawing observation scopes once they are no longer valid.
This necessitated a different metadata protocol for composable functions, which means that composable functions compiled with the alpha07 compiler will not be binary compatible with composable functions compiled with any earlier compiler version. ( aosp/1431988) androidx.compose.compiler:compiler:1.0.0-alpha06 is released.
Version 1.0.0-alpha07 contains these commits. Stability Inference & Propagation. The Compose Compiler Plugin will analyze types it compiles to infer whether or not it is eligible for certain optimizations by the runtime. This inferred result is then synthesized as metadata onto the class to be utilized by the compiler in other modules.
You need to add compose runtime dependency.
dependencies {
def compose_version = "1.0.0-beta07"
implementation("androidx.compose.runtime:runtime:$compose_version")
}
I finally fixed it by declaring an explicit dependency on androidx.activity:activity-compose (similar to this answer) in both my app module as well as my compose module, which the app module depends on. Before, I declared the activity compose dependency only in my compose module, not my app module.
This is what my setup looks like now:
// build.gradle (:app)
android {
...
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion Versions.compose
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation project(':core')
implementation project(':common-ui-compose')
...
implementation Libs.AndroidX.Activity.activityCompose
// build.gradle (:common-ui-compose)
android {
...
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion Versions.compose
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation project(':core')
...
implementation Libs.AndroidX.Activity.activityCompose
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With