Coder Social home page Coder Social logo

"androidx dependency" is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler about compose-multiplatform HOT 25 CLOSED

jetbrains avatar jetbrains commented on May 14, 2024 4
"androidx dependency" is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler

from compose-multiplatform.

Comments (25)

veyndan avatar veyndan commented on May 14, 2024 4

I'm facing the same issue as @ggoraa, and my settings.gradle.kts is identical to that found in the Getting Started guide:

pluginManagement {
    repositories {
        gradlePluginPortal()
        maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
    }
}

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

We had similar problem earlier:
#21

And fixed it with #30

(we moved buildscript from settings.gradle.kts to the root build.gradle.kts and the problem was gone)

Do you have buildscript in settings.gradle.kts?

from compose-multiplatform.

Animeshz avatar Animeshz commented on May 14, 2024

Same issue :(

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

Can you tell which versions of IDEA and Kotlin IDEA plugin do you use?

If it is possible it would be very helpful if you attach project archive here.

from compose-multiplatform.

Animeshz avatar Animeshz commented on May 14, 2024

Intellij IDEA: 2020.2
Kotlin (plugin): 1.4.10
JB Compose: 0.1.0-m1-build62
JDK Version: 11.0.8
JVM Target: 1.8

from compose-multiplatform.

subashz avatar subashz commented on May 14, 2024

Same issue.
It happens after creating multiplatform projects from intellij.
Intellij IDEA: 2020.3 EAP
Runtime version: 11.0.8
VM: Open JDK [64bit]

Repro: https://gofile.io/d/WpJQbh

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

Intellij IDEA: 2020.2
Kotlin (plugin): 1.4.10
JB Compose: 0.1.0-m1-build62
JDK Version: 11.0.8
JVM Target: 1.8

Unfortunately I can't reproduce the issue on this configuration.
I tried to open these templates:
https://github.com/JetBrains/compose-jb/tree/master/templates/desktop-template (which is almost the same as described in https://github.com/JetBrains/compose-jb/tree/master/tutorials/Getting_Started)
https://github.com/JetBrains/compose-jb/tree/master/templates/multiplatform-template

Can anyone that have this issue attach archive with project?

Also is there "-Xuse-ir" in Project Settings?
image
It should be added automatically after the import of the project.
If not - will it be added after Gradle Sync?
image

from compose-multiplatform.

subashz avatar subashz commented on May 14, 2024

Repro: https://gofile.io/d/WpJQbh

from compose-multiplatform.

Animeshz avatar Animeshz commented on May 14, 2024

Strange enough, The same thing happens with the desktop-template project as well when (importing in Intellij).

from compose-multiplatform.

subashz avatar subashz commented on May 14, 2024

I don't have any issue with desktop-template based project. It only happens on MPP template for me.

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

Repro: https://gofile.io/d/WpJQbh

Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version)

Try this:
demo.zip

I changed version to "0.1.0-m1-build62" and converted desktop module from kotlin("jvm") to kotlin("multiplatform")
(kotlin("jvm") doesn't work well in multiplatform project)

from compose-multiplatform.

subashz avatar subashz commented on May 14, 2024

Got new error after tyring to run desktop app,

Repro: https://gofile.io/d/WpJQbh

Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version)

Try this:
demo.zip

I changed version to "0.1.0-m1-build62" and converted desktop module from kotlin("jvm") to kotlin("multiplatform")
(kotlin("jvm") doesn't work well in multiplatform project)

Got new error after trying to run desktop app: Gradle > desktop > Tasks > application > run
https://pastebin.com/0MWuepJe

But it works fine if I replace

import me.subash.common.App
import androidx.compose.desktop.Window

fun main() = Window {
    App()
}

with

import androidx.compose.desktop.Window
import androidx.compose.material.Text

fun main() = Window {
    Text("Hello")
}

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

Got new error after tyring to run desktop app,

Repro: https://gofile.io/d/WpJQbh

Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version)
Try this:
demo.zip
I changed version to "0.1.0-m1-build62" and converted desktop module from kotlin("jvm") to kotlin("multiplatform")
(kotlin("jvm") doesn't work well in multiplatform project)

Got new error after trying to run desktop app: Gradle > desktop > Tasks > application > run
https://pastebin.com/0MWuepJe

But it works fine if I replace

import me.subash.common.App
import androidx.compose.desktop.Window

fun main() = Window {
    App()
}

with

import androidx.compose.desktop.Window
import androidx.compose.material.Text

fun main() = Window {
    Text("Hello")
}

I forgot to change version in android/build.gradle.kts and common/build.gradle.kts

(you can redownload demo from a comment above, I changed the version)

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

Do you have buildscript in settings.gradle.kts?

I have just copy pasted all code from your getting started guide, and the IDEA just gone wild with errors.

EDIT: I moved pluginManagement part to build.gradle.kts, aaand... Everything just broke. Maybe I misunderstood you :D

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version)
Try this:
demo.zip

Forgot to say, I have the Kotlin/JVM project, not the MPP one

EDIT: Also forgot to say:

Kotlin plugin: 1.4.10
JVM target: 11
JDK: OpenJDK14
IDEA: Latest stable

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

If it is possible it would be very helpful if you attach project archive here.

Easily. https://drive.google.com/file/d/1VRKk64t8z7GwYD6H2bp1hoF6z7nzYqFq/view?usp=sharing

from compose-multiplatform.

olonho avatar olonho commented on May 14, 2024

What exactly version of IDEA? 2020.2.3?

from compose-multiplatform.

X1nto avatar X1nto commented on May 14, 2024

This is what I did to fix the problem: Went into project structure, I had "Use project settings" ticked so I clicked on "Edit project settings" and changed Target JVM Version to 11, then added -Xuse-ir to the command line options, after these operations red lines were gone. Screenshot of my project settings:
image

EDIT: I'm using 0.1.0-build113 btw

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

What exactly version of IDEA? 2020.2.3?

yes

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

I upgraded to the latest build of JetBrains Compose plugin, added the command line argument, and it is finally working! No more red lines :D

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

If it is possible it would be very helpful if you attach project archive here.

Easily. https://drive.google.com/file/d/1VRKk64t8z7GwYD6H2bp1hoF6z7nzYqFq/view?usp=sharing

I changed the Gradle version from 6.3 to 6.5.1 and red underlining is gone.
On Gradle 6.7 and Compose 0.1.0-build113 everything is fine too.

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

I will try this too

from compose-multiplatform.

ggoraa avatar ggoraa commented on May 14, 2024

I also forgot that my target JVM version was 1.6, after the upgrade to 11 every single error is gone

from compose-multiplatform.

igordmn avatar igordmn commented on May 14, 2024

It seems that everything is ok on the latest Gradle (6.7.1), Compose (0.2.0-build129), Kotlin (1.4.20) and Idea (2020.2.3).

We shouldn't manually add "-Xuse-ir" in project settings. It should be added automatically after Gradle Sync.

So if no one encounters this issue again I think we can close it.

Also if it still an issue, maybe similar changes will help:
https://github.com/JetBrains/compose-jb/pull/30/files

from compose-multiplatform.

steklopod avatar steklopod commented on May 14, 2024

My solution:
build.gradle.kts

plugins {
    val kotlin = "1.5.0-M1"
    kotlin("jvm") version kotlin
}
tasks{
            val java: String by project
            withType<KotlinCompile> {
                kotlinOptions { freeCompilerArgs += listOf("-Xskip-prerelease-check", "-Xjsr305=strict"); jvmTarget = java }; sourceCompatibility = java; targetCompatibility = java
            }
}

image

from compose-multiplatform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.