How to set koin-annotations with Kotlin 2.1.20-RC2? After upgrading to 2.1.20-RC2, it build failed:
Copy code
Reason: Task ':composeApp:kspDebugKotlinAndroid' uses this output of task ':composeApp:kspCommonMainKotlinMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':composeApp:kspCommonMainKotlinMetadata' as an input of ':composeApp:kspDebugKotlinAndroid'.
2. Declare an explicit dependency on ':composeApp:kspCommonMainKotlinMetadata' from ':composeApp:kspDebugKotlinAndroid' using Task#dependsOn.
3. Declare an explicit dependency on ':composeApp:kspCommonMainKotlinMetadata' from ':composeApp:kspDebugKotlinAndroid' using Task#mustRunAfter.
After removing this, it will not have the above error. Should I replace it in a new way?
Copy code
project.tasks.withType(KotlinCompilationTask::class.java).configureEach {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
👍 1
FlowFan
03/26/2025, 1:33 AM
Kotlin 2.1.20 is release, is there any way to set koin-annotations?
k
Kibet Theophilus
03/26/2025, 5:39 AM
Not sure if there is a any new way, but I removed the above block and it fixed the error.
From my understanding, this was just a work around for KSP. So probably it has been fixed on the latest versions.
f
FlowFan
03/26/2025, 9:43 AM
This code cannot be deleted because it will affect the generation of ksp code of Android target. You can clean build and try again.
k
Kibet Theophilus
03/26/2025, 1:03 PM
@FlowFan what error do you get when you remove?
f
FlowFan
03/27/2025, 12:57 AM
If use ksp generated code, such as defaultModule, the error is Unresolved reference 'ksp'.