Chi*_*ori 6 java android gradle kotlin android-studio
版本
\n/Applications/Android\\ Studio.app/Contents/jre/jdk/Contents/Home/bin/java -version是\nopenjdk 版本“11.0.8”2020-07-14升级到Android Studio 4.2后,我的项目无法构建。我的所有 KotlinScript 文件都无法被 AS 识别,Gradle 同步也失败。
\n命令行上的 Gradle 继续正常工作。
\n这是我的顶级build.gradle.kts,我也看到每个模块的相同结果(这只是几个示例之一)。具有语法突出显示问题的图像位于: https: //i.stack.imgur.com/bvjVz.png
// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n extra["kotlin_version"] = "1.5.0"\n\n repositories {\n google()\n }\n\n dependencies {\n classpath(kotlin("gradle-plugin", version = rootProject.extra["kotlin_version"] as String?))\n classpath("com.android.tools.build:gradle:4.1.3")\n classpath("com.squareup.sqldelight:gradle-plugin:1.4.4")\n classpath("com.github.ben-manes:gradle-versions-plugin:0.38.0")\n\n // NOTE: Do not place your application dependencies here; they belong\n // in the individual module build.gradle files\n }\n}\n\nplugins {\n id("com.github.ben-manes.versions") version "0.38.0"\n id("io.gitlab.arturbosch.detekt") version "1.16.0"\n}\n\nallprojects {\n repositories {\n google()\n jcenter()\n maven("https://jitpack.io")\n }\n}\n\nsubprojects {\n apply {\n plugin("io.gitlab.arturbosch.detekt")\n }\n\n detekt {\n config = rootProject.files("detekt.yml")\n reports {\n html {\n enabled = true\n destination = file("build/reports/detekt.html")\n }\n }\n }\n}\n\ntasks.withType<KotlinCompile> {\n kotlinOptions {\n jvmTarget = "1.8"\n }\n}\n\nRun Code Online (Sandbox Code Playgroud)\n错误总结:
\nCannot access \'java.lang.Object\' which is a supertype of \'org.gradle.kotlin.dsl.KotlinBuildScript\'. Check your module classpath for missing or conflicting dependencies\nRun Code Online (Sandbox Code Playgroud)\nCannot access \'java.lang.Comparable\' which is a supertype of \'org.gradle.kotlin.dsl.KotlinBuildScript\'. Check your module classpath for missing or conflicting dependencies\nRun Code Online (Sandbox Code Playgroud)\n我尝试使我的项目与所有最新版本兼容,包括 Gradle 7.0。破坏该项目的唯一变量是将 Android Studio 升级到 4.2,且源代码树没有任何更改。
\n这是一个已知问题/我是否遗漏了一些明显的东西?
\n我已经习惯了每次 Android Gradle 插件更新时我的项目就会崩溃,但是这一次,即使没有对源代码进行任何更改,它也会发生 xe2x80x99s。
\n小智 5
今天早上我在 Linux 机器上将 Android Studio 从 4.2.0 版本更新到 4.2.1 版本后遇到了完全相同的问题。
这是我修复它的方法:
/usr/lib/jvm/java-11-openjdk。并应用更改。现在错误应该消失了。
| 归档时间: |
|
| 查看次数: |
1302 次 |
| 最近记录: |