Cannot access 'com.android.build.gradle.internal.dsl.Lockable' on Android Studio Arctic Fox | 2020.3.1 Canary 12

Viewed 912

how are you doing?

Did you get this kind of error when writing a gradle plugin using kotlin DSL:

Cannot access 'com.android.build.gradle.internal.dsl.Lockable' which is a supertype of 'com.android.build.gradle.BaseExtension'. Check your module classpath for missing or conflicting dependencies

Here is the complete code:

import org.gradle.api.Project
import com.android.build.gradle.BaseExtension
import org.gradle.kotlin.dsl.getByType

private typealias AndroidBaseExtension = BaseExtension

fun Project.configureAndroid() = this.extensions.getByType<AndroidBaseExtension>().run{
    compileSdkVersion(30)
}

Thanks in advance for your HELP.

2 Answers

You need a dependency on the new version

implementation("com.android.tools.build:gradle:7.1.0-alpha12")

in your build.gradle.kts (buildSrc module)

delete ~/.gradle/caches, Invalidate Caches and Restart Android Studio, problem fixed, at least for me.

Related