Hi all :android-wave: , I am trying to migrate my ...
# k2-adopters
a
Hi all 👋 , I am trying to migrate my project (https://github.com/Abhimanyu14/finance-manager) to use K2. It is an Android Jetpack Compose project. I am following this guide for the migration. https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compiler.html#migrating-a-jetpack-compose-project I am getting errors in the process. More details in thread. 🧵 Please help thank you color
solved 1
I do not have
androidx.compose.compiler:compiler
or
androidx.compose.compiler:compiler-hosted
. How to proceed with this step?
How to migrate this code?
Copy code
composeOptions {
        kotlinCompilerExtensionVersion = "1.5.12" // jetpackComposeCompilerVersion
}
s
Just remove the version, keep buildFeatures.compose = true The new compiler Gradle plugin will substitute dependencies automatically
âž• 1
thank you color 1
a
Thanks @shikasd thank you color Sharing the steps I did, incase anyone else faces similar issues. 1. In
libs.version.toml
, Updated Libraries
Copy code
com.google.devtools.ksp:symbol-processing-api => "2.0.0-1.0.21"
Plugins
Copy code
org.jetbrains.kotlin.android => "2.0.0"
org.jetbrains.kotlin.jvm => "2.0.0"
org.jetbrains.kotlin.plugin.serialization => "2.0.0"
com.google.devtools.ksp => "2.0.0-1.0.21"
Error
Copy code
This version (1.5.12) of the Compose Compiler requires Kotlin version 1.9.23 but you appear to be using Kotlin version 2.0.0 which is not known to be compatible.
Compose compiler defined like this in all feature modules using compose.
Copy code
android {
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.12" // jetpackComposeCompilerVersion
    }
}
This page https://developer.android.com/jetpack/androidx/releases/compose-kotlin suggested https://developer.android.com/develop/ui/compose/compiler for K2. 2. Added
"org.jetbrains.kotlin.plugin.compose"
plugin with same version as
org.jetbrains.kotlin.android
. 3. Added compose compiler plugin to app and other features modules using Compose. 4. Removed the
kotlinCompilerExtensionVersion
as suggested in the above message.
s
I think it is partially a documentation issue, need to update this paragraph to remove "if you use Android build feature" part
âž• 1