question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntelliJ Idea 2022.2 cannot resolve compose imports.

See original GitHub issue

Idea 2022.2 doesn’t resolve compose imports with latest compose dev release.

Steps to reproduce:

  1. Use Idea 2022.2 to create Compose Multiplatform multiple platforms project Observe that compose imports are correctly resolved.
  2. 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 Idea2022-Compose-imports

Additional notes:

  • Compose imports are resolved correctly in Idea 2022.1.4
  • Gradle builds are successful

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
igordmncommented, Aug 12, 2022

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

1reaction
ionspincommented, Aug 11, 2022

@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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

2022.2.1-RC cannot resolve multiplatform compose imports
Use Idea 2022.2 to create Compose Multiplatform multiple platforms project. Observe that compose imports are correctly resolved.
Read more >
Intellij doesn't prompt to import androidx.compose
I created a Kotlin multiplatform project. On a unresolvable symbol like "Modifier", I press ALT + ENTER, then Intellij prompts me to import...
Read more >
New features in Android Studio Preview
2 platform update. Android Studio Flamingo Canary 1 includes the IntelliJ IDEA 2022.2 updates, which improve the IDE experience. For details on the...
Read more >
Android Studio Release Updates
General fixes and features · Issue #211012777: lint. · Issue #197342475: Android Gradle Plugin 7.0+ and Android Tests issue: Cannot find resource: id...
Read more >
IntelliJ IDEA Error – Cannot run program – No such file or ...
Navigate to the File Menu and go to Project Structure. Under the Project SDK section, make sure to add the new SDK you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found