Open arkivanov opened 1 year ago
Just wanted to add the link to the related discussions on Slack: https://kotlinlang.slack.com/archives/C3PQML5NU/p1652224566469179
If you apply the original androidx compose libraries to the Android source set (androidMain
), the IDE issue is gone.
try specifying these two properties in gradle properties of the project & subprojects
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.hierarchicalStructureSupport=true
@wakaztahir Isn't HMPP is enabled by default since 1.6.20
? https://kotlinlang.org/docs/multiplatform-hierarchy.html
yeah , I thought you might have them false , since I was having issues and found it was false
It seems reproducible with AGP 7.2.2
, but isn't reproducible with AGP 7.3.0
or AGP 7.1.3
.
AGP 7.3.0
is supported by IDEA 2022.3 EAP (223.4884.69) and Android Studio Dolphin 2021.3.1
I couldn't use AGP 7.1.3
with Kotlin 1.7.10
. For example Android lint fails with error messages like:
> Task :common:database:lintAnalyzeDebug
e: /Users/arkivanov/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.7.10/d70d7d2c56371f7aa18f32e984e3e2e998fe9081/kotlin-stdlib-jdk8-1.7.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/arkivanov/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.10/1ef73fee66f45d52c67e2aca12fd945dbe0659bf/kotlin-stdlib-jdk7-1.7.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/arkivanov/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/arkivanov/dev/workspace/compose-jb/examples/todoapp/common/database/build/.transforms/1c2bbefbddd565671d87bbbe54277e4b/transformed/out/jars/classes.jar!/META-INF/database_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/arkivanov/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-test-junit/1.7.10/27228b08adb999a47ae98ac03e98e1f3132f83ca/kotlin-test-junit-1.7.10.jar!/META-INF/kotlin-test-junit.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/arkivanov/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-test/1.7.10/4d644a88cc0a386712d4b1c1b4ca748203421e07/kotlin-test-1.7.10.jar!/META-INF/kotlin-test.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/arkivanov/dev/workspace/compose-jb/examples/todoapp/common/database/build/tmp/kotlin-classes/debug/META-INF/database_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
Meantime, there seems to be a workaround with AGP 7.2.2
. Just add Jetpack Compose original dependencies in pure Android modules and androidMain
KMP source sets.
implementation("androidx.compose.foundation:foundation:1.2.1")
implementation("androidx.compose.material:material:1.2.1")
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
This happens for me for a couple of months already. All MPP Compose references are red (unresolved) in all
androidMain
source sets in all IDEs. Other KMP libraries work fine. Everything compiles just fine.Kotlin
1.7.0
,1.7.10
Compose1.2.0-alpha01-dev753
,1.2.0-beta01
Gradle7.4.2
,7.5.1
AGP7.2.2
.I have tried different IDEs:
I have also tried different OSs - Ubuntu and macOS.
I have attached a reproducer project - Reproducer.zip.