I’m using EAP and I’m having the following error: ...
# eap
g
I’m using EAP and I’m having the following error:
Copy code
Incompatible Kotlin/Native libraries
There are 549 libraries libraries from the Kotlin/Native 1.3.72 distribution attached to the project: stdlib, ARKit, ARKit, ARKit, AVFoundation, ...
These libraries were compiled with an older Kotlin/Native compiler and can't be read in IDE.
Please edit Gradle buildfile(s) to use Kotlin Gradle plugin version 1.4-M2. Then re-import the project in IDE.
My project is already using
1.4-M2
, as suggested, but I suppose the problem comes from Gradle, since
6.5
(latest) version points to
1.3.72
. Does someone know what we can do about it? How can we configure the project to avoid this error? I’m not sure, but I’m facing a issue where the run/debug buttons are not working as well. I’m using the latest IntelliJ EAP
g
I don’t think that Gradle is the reason, bundled Kotlin to Gradle used only to compile Gradle kts config files it’s not used on runtime. Also it’s Kotlin JVM only not related on K/N
a
Please check that all Gradle modules actually receive the correct 1.4-M2 dependencies (with
./gradlew dependencies
) and the 1.4-M2 IDE plugin is installed. It should work. If it doesn't - please report an issue at http://kotl.in/issue with a sample project to reproduce, so we can investigate it.
g
I downgraded to
1.3.72
and it is working fine, but I’ll take a look and return. But I do have a
buldSrc
module that compiles kotlin things, specially, I cannot control which kotlin version will be used there in a good way, since, I think, the plugin
kotlin_dsl
uses a different version of Kotlin.
l
@GarouDan Does your
buildSrc
depend on the kotlin gradle plugin itself?
g
It has
org.jetbrains.kotlin:kotlin-gradle-plugin
as one if its dependencies (but I was getting the
1.4-M2
there, as I checked). I’ll attach the full file here.
l
@GarouDan Can you try to perform a gradle clean after using 1.4-M2?
g
Unfortunately I cannot create a file snippet, which would be better:
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
	`kotlin-dsl`
}

// TODO Due to Gradle limitation we needed to bundle all code of the plugins together.
apply("../plugin/bundle.gradle.kts")

@Suppress("unchecked_cast", "nothing_to_inline")
inline fun <T> uncheckedCast(target: Any?): T = target as T

val getProperty = uncheckedCast<(key: String) -> String>(extra["getProperty"])
val getDependency = uncheckedCast<(group: String, dependencyId: String) -> String>(extra["getDependency"])
val getDependencyVersion = uncheckedCast<(group: String, dependencyId: String) -> String>(extra["getDependencyVersion"])

repositories {
	flatDir { dirs("$rootDir/plugin") }
	mavenLocal()
	gradlePluginPortal()
	mavenCentral()
	jcenter()
	google()
	maven( url = "<https://plugins.gradle.org/m2>" )
	maven( url = "<https://repo.gradle.org/gradle/libs-releases-local>" )
	maven( url = "<https://dl.bintray.com/kotlin/kotlin-eap>" )
	// maven( url = "<https://dl.bintray.com/kotlin/kotlin-dev>" )
}

dependencies {
	// For extending Gradle classes
	implementation(gradleApi())

	// For exteding the Gradle Kotlin plugin classes. The current kotlin version should be grabbed.
	implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")

	// For Jackson support
	implementation(getDependency("buildSrc/build.gradle.kts", "com.fasterxml.jackson.core:jackson-databind"))
	implementation(getDependency("buildSrc/build.gradle.kts", "com.fasterxml.jackson.module:jackson-module-kotlin"))
//	implementation(getDependency("buildSrc/build.gradle.kts", "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"))

	// For buildSrc tests
	testImplementation(getDependency("buildSrc/build.gradle.kts", "junit:junit"))
}

/**
 * Using `-Xskip-metadata-version-check` we avoid problems when using the most recent kotlin versions.
 */
tasks.withType<KotlinCompile> {
	kotlinOptions {
		freeCompilerArgs = listOf("-Xskip-metadata-version-check")
	}
}
@louiscad, I was using
git clean -dfx
, which would be better for clean, but I was still facing the problem.
l
@GarouDan I'm talking about
./gradlew clean
, not git related stuff
g
Ok, I will try later and return. One curiosity, as far as I know, gradle clean only clean the build folders no? Does it do something more?
l
It can do more if a plugin added a task dependency to the
clean
task.
g
Oh, you’re right. Sorry for that
l
No worries
g
I’ll need a bit more time to upgrade again, since I’m working in a new feature. But I’ll try soon 😉
👌 1
I’ve found the problem. Or at least I think it is very related to the first thing that I wrote. It looks like it is not entirely related with Kotlin
1.4-M2
, but with IntelliJ and it is a bit annoying. When in IntelliJ, it seems the Gradle environment only works with my
11.0.6-zulu
jdk. I changed the settings to very different options and it only worked with this version. For example
11.0.7.fx-zulu
and
14.0.1-zulu
don’t work there. The project can be configured to use Kotlin
1.4-M2
and Gradle
6.5
(I’m investing more), but if you change the settings in:
Preferences -> Build, Execution, Deployment -> Gradle
to: Use Gradle from -> “wrapper task” Gradle JVM -> “11.0.6-zulu” (in my case changing here to other JDK versions do not work) seems to work.