Hi I need help with the following error: ```This J...
# gradle
s
Hi I need help with the following error:
Copy code
This JVM does not support getting OS memory, so no OS memory status updates will be broadcast
Initialized native services in: /home/samyak/Kotlin/master/kotlin-1.3.30/.gradle/native
:kotlin-gradle-plugin:compileGroovy FAILED
:kotlin-gradle-plugin:compileGroovy (Thread[Task worker for ':' Thread 4,5,main]) completed. Took 7.665 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kotlin-gradle-plugin:compileGroovy'.
> android/databinding/tool/LayoutXmlProcessor$OriginalFileLookup has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':kotlin-gradle-plugin:compileGroovy'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
FULL LOGS: https://paste.ubuntu.com/p/MsvSXmh9bB/
o
it looks like you need to compile with Java 11 (that's class file 55)
s
There is a little hiccup. The some part of package needs Java 8 while other Java 11. how can I work on two different?
o
compile with 11, set sourceCompatibility and targetCompatibility appropriately
one pitfall is that you can still use 9+ functions in the java 8 code, but to fix that you need to use
--release
in the appropriate java compiler: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.compile.CompileOptions.html#org.gradle.api.tasks.compile.CompileOptions:compilerArgs
s
@octylFractal I will be more verbose. I'm trying to compile Kotlin with the Gradle 4.4.1 which needs Java 8. But this kotlin-gradle-plugin needs class file 55 as the error mentioned. How can I proposed with it?
o
I don't think you can, that's just not possible. You must upgrade Gradle
I guess the alternative is find out what dependency contains the Java 11 files, and downgrade it
I'm honestly surprised that
android
stuff would be compiled with 11, that's not typical.
s
o
right, but where are you even getting " android/databinding/tool/LayoutXmlProcessor$OriginalFileLookup" that's Java 11?
s
Yea, the weird part is the 1.3.30 is fine with java 8 while the older version doesn't support it
1.2.3
1.2.4
o
Copy code
Replacing com.android.tools.build:gradle:jar:2.0.0  ->  com.android.tools.build:gradle:jar:debian
	Replacing org.codehaus.groovy:groovy-all:jar:2.4.12  ->  org.codehaus.groovy:groovy-all:jar:debian
this is kinda weird
s
Aha, the main objective is to package kotlin and then update gradle for Debian repos
o
well, those probably need to be compiled with java 8
s
Yea! I'm not sure where I'm going wrong 😞
I'll research more!
402 Views