Versions
- Android Studio 4.2
- Gradle 7.0
- AGP: 4.1.3 (I see the same results with AGP 4.2, so I am opting instead to keep as many variables constant as possible.)
- Kotlin: 1.5
- JDK:
/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/java -versionis openjdk version "11.0.8" 2020-07-14 - Mac OX Big Sur 11.3.1
After upgrading to Android Studio 4.2, my project cannot be built. All my KotlinScript files fail to be recognized by AS, and Gradle sync fails as well.
Gradle on the command-line continues to work correctly.
This is my top-level build.gradle.kts, and I see the same results for every module as well (this one is just one of several samples). Image with syntax highlighting issues is here: https://i.stack.imgur.com/bvjVz.png
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
extra["kotlin_version"] = "1.5.0"
repositories {
google()
}
dependencies {
classpath(kotlin("gradle-plugin", version = rootProject.extra["kotlin_version"] as String?))
classpath("com.android.tools.build:gradle:4.1.3")
classpath("com.squareup.sqldelight:gradle-plugin:1.4.4")
classpath("com.github.ben-manes:gradle-versions-plugin:0.38.0")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id("com.github.ben-manes.versions") version "0.38.0"
id("io.gitlab.arturbosch.detekt") version "1.16.0"
}
allprojects {
repositories {
google()
jcenter()
maven("https://jitpack.io")
}
}
subprojects {
apply {
plugin("io.gitlab.arturbosch.detekt")
}
detekt {
config = rootProject.files("detekt.yml")
reports {
html {
enabled = true
destination = file("build/reports/detekt.html")
}
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
Summary of errors:
Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.kotlin.dsl.KotlinBuildScript'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.lang.Comparable' which is a supertype of 'org.gradle.kotlin.dsl.KotlinBuildScript'. Check your module classpath for missing or conflicting dependencies
I tried making my project compatible with the latest versions of everything, including Gradle 7.0. The only variable that breaks the project is upgrading Android Studio to 4.2, with no changes to the source tree.
Is this a known issue / am I missing something obvious?
I am used to my project breaking every time the Android Gradle Plugin is updated, but this time, it’s happening even without any changes to source.