butterknife 问题,在使用最新的 gradle 插件更新到最新版本的 android studio 后

问题描述 投票:0回答:1

这是日志

'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.

我期望能成功运行它

android kotlin gradle butterknife
1个回答
0
投票

在对此进行所有研究之后,我找到了对我有用的解决方案 只需将代码添加到您的应用程序级 gradle.build 文件

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',
    ]
      
}
© www.soinside.com 2019 - 2024. All rights reserved.