0

this is log 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

I expected to run it successfully

Zaman Rajpoot
  • 326
  • 2
  • 5

2 Answers2

0

After all research on this, i found solution this worked for me just add the code in your app-level gradle.build file

android 
   {
    tasks.withType(JavaCompile).configureEach {
    options.fork = true
    options.forkOptions.jvmArgs += [
    '--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
    '--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
    ]
      
}
Zaman Rajpoot
  • 326
  • 2
  • 5
-1

A workaround can be found here:

# <app/build.gradle>

# https://stackoverflow.com/questions/65380359/lomboks-access-to-jdk-compilers-internal-packages-incompatible-with-java-16

# enable internal JDK API access at runtime
tasks.withType(JavaCompile).configureEach {
    options.fork = true
    options.forkOptions.jvmArgs += [
        # essential for butterknife
        '--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',

        # if you need Glide or LomBok
        # these may not be the exact list, but it works for me
        '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
        '--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
    ]
}
# <gradle.properties>

# https://developer.android.com/build/releases/gradle-plugin#default-changes

# @BindView requires a constant resource ID
android.nonFinalResIds=false
Atick Faisal
  • 1,086
  • 1
  • 6
  • 13