IntelliJ Idea 2022.2 cannot resolve compose imports.
Idea 2022.2 doesn't resolve compose imports with latest compose dev release.
Steps to reproduce:
- Use Idea 2022.2 to create Compose Multiplatform multiple platforms project Observe that compose imports are correctly resolved.
- Change gradle.properties versions to the following:
kotlin.version=1.7.10
agp.version=7.2.0
compose.version=1.2.0-alpha01-dev753
Observe that the imports are not correctly resolved

Additional notes:
- Compose imports are resolved correctly in Idea 2022.1.4
- Gradle builds are successful
Also reported on JetBrains bug tracker https://youtrack.jetbrains.com/issue/KTIJ-22349/IntelliJ-Idea-20222-cannot-resolve-multiplatform-compose-imports
I had something similar and it was resolved by using Idea 2022.2.1 Preview.
@serandel 2022.2.1 RC solved it for me as well. Thanks for giving me this hint I wasn't aware there were preview builds outside of EAP. I'll close this issue!
I've already updated the issue on JetBrains' tracker (with a screenshot), but I'll just also note here that 2022.2.1 RC did not fix the issue for me. Though since the OP mentioned Gradle builds are still successful I just noticed that trying a normal ./gradlew :android:assemble comes back with the error:
e: This version (1.2.0) of the Compose Compiler requires Kotlin version 1.7.0 but you appear to be using Kotlin version 1.7.10 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
(I'm aware that this is more of a warning, because the Compose plugin could still be compatible, technically, but it did fail the build for me.)
I've only followed the reproduction steps given above, so it sounds like there's something else going on.
Hey @EddieRingle, that's not a warning it's an actual error that will fail your build. You can suppress it, but in my experience it never worked when there was a Compose Compiler/Kotlin version mismatch.
Yes, it is technically an error for Gradle. This should disable the check:
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += listOf(
"-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
)
}
}
It works with 1.7.10, because we are lucky that there weren't incompatible changes.
Better to use the new compiler that officially supports the new Kotlin:
allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("org.jetbrains.compose.compiler:compiler")).apply {
using(module("androidx.compose.compiler:compiler:1.2.1-dev-k1.7.10-27cf0868d10"))
}
}
}
}
It is still unofficial, but it works. We are working on the official way to use different Kotlin. It will be similar to Jetpack Compose way
@igordmn Thanks, yes, that's basically what I do in my projects. I was just pointing out that the original issue as described isn't properly reproducible because Gradle cannot build successfully without that additional step. There is still some sort of issue somewhere, however, as 2022.2.1 didn't necessarily fix anything (because I still see the issue with imports, for example).