I'm having this weird error when using delegated p...
# announcements
f
I'm having this weird error when using delegated properties in Kotlin 1.4, any idea what is causing it?
Copy code
Caused by: java.lang.NoSuchMethodError: kotlin.jvm.internal.FunctionReferenceImpl.<init>(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
t
make sure everything is kotlin 1.4. I had something similar because some library was somehow forcing
kotlin-stdlib-common
to version 1.3.72
f
It looks like gradle is forcing kotlin 1.3.72 to be in the classpath, I don't know how to prevent that. I mean literally gradle itself, not any library.
JAR 'kotlin-stdlib-1.3.72.jar' required by module 'gradle-model-core'
t
can you share the gradle file? also,
./gradlew dI --dependency kotlin-stdlib
and
./gradlew bE
could help identify the dependency (former) and plugin (latter) forcing the wrong dependency
f
it is not a plugin or dependency, it's gradle itself
Using that command I only get kotlin 1.4.0
But yet I still get this
Copy code
Task :buildSrc:compileKotlin
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/natan/.gradle/wrapper/dists/gradle-6.6.1-all/ejrtlte9hlw8v6ii20a9584rs/gradle-6.6.1/lib/kotlin-stdlib-1.3.72.jar (version 1.3)
    C:/Users/natan/.gradle/wrapper/dists/gradle-6.6.1-all/ejrtlte9hlw8v6ii20a9584rs/gradle-6.6.1/lib/kotlin-stdlib-common-1.3.72.jar (version 1.3)
    C:/Users/natan/.gradle/wrapper/dists/gradle-6.6.1-all/ejrtlte9hlw8v6ii20a9584rs/gradle-6.6.1/lib/kotlin-stdlib-jdk7-1.3.72.jar (version 1.3)
    C:/Users/natan/.gradle/wrapper/dists/gradle-6.6.1-all/ejrtlte9hlw8v6ii20a9584rs/gradle-6.6.1/lib/kotlin-stdlib-jdk8-1.3.72.jar (version 1.3)
    C:/Users/natan/.gradle/wrapper/dists/gradle-6.6.1-all/ejrtlte9hlw8v6ii20a9584rs/gradle-6.6.1/lib/kotlin-reflect-1.3.72.jar (version 1.3)
    C:/Users/natan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.4.0/e3765b66f0610afc92053ff1a93a87a544fca2b/kotlin-stdlib-jdk8-1.4.0.jar (version 1.4)
    C:/Users/natan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.4.0/aa2101a19d8688e368ae6e35e8967550ced73884/kotlin-reflect-1.4.0.jar (version 1.4)
    C:/Users/natan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.4.0/9cc187c3dfaf6e4001bdf962e3cdadff7690261b/kotlin-stdlib-jdk7-1.4.0.jar (version 1.4)
    C:/Users/natan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.0/63e75298e93d4ae0b299bb869cf0c627196f8843/kotlin-stdlib-1.4.0.jar (version 1.4)
    C:/Users/natan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.0/1c752cce0ead8d504ccc88a4fed6471fd83ab0dd/kotlin-stdlib-common-1.4.0.jar (version 1.4)
w: Consider providing an explicit dependency on kotlin-reflect 1.4 to prevent strange errors
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
u
If you’re not using any API from the Kotlin standard library of 1.4, you can try compiling this code with
-api-version 1.3
, in which case the compiler will avoid using the new constructions not available in kotlin-stdlib 1.3 (such as
kotlin.jvm.internal.FunctionReferenceImpl.<init>(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
)