Gradle Build Failure: Inconsistent JVM Target Compatibility for Kotlin and Java Closed

24 Views Asked by At

Even after configuring the compileOptions and kotlinOptions with the appropriate Java version compatibility settings, the build process is still failing with the same error message regarding the inconsistency in JVM target compatibility between Kotlin and Java tasks. Despite explicitly setting the source and target compatibility to JavaVersion.VERSION_1_8 and specifying the JVM target as '1.8' respectively, the issue persists. Additional insights or alternative solutions are sought to resolve this persistent Gradle build failure.

My received message in the terminal :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':device_info_plus:compileReleaseKotlin'.
> 'compileReleaseJavaWithJavac' task (current target is 17) and 'compileReleaseKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
Running Gradle task 'assembleRelease'...                         2,753ms
Gradle task assembleRelease failed with exit code 1

0

There are 0 best solutions below