0

I have just started learning KotlinDSL recently. And in Android added buildSrc. In this folder I have module plugins: AppModulePlugin, CommonModulePlugin, FeatureModulePlugin. All of this compiles and the application installs correctly, everything is fine. but in these files a warning is displayed:

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

Please tell me how to get rid of these warnings?

enter image description here

No Name
  • 741
  • 8
  • 18

1 Answers1

0

IntelliJ has had this issue for months unfortunately - it reports correct code as invalid. See KTIJ-3769. I believe it's dependent on ticket KTIJ-19669.

As a workaround you can either replace the helper methods that the plugins introduce with 'plain' Gradle Kotlin

// androidExtension { }

project.extensions.configure<BaseExtension> { 
  
}

Or only create buildSrc plugins in Kotlin (*.kt files), not Kotlin Script (*.kts files). This requires using the java-gradle-plugin and defining the plugins in buildSrc/build.gradle.kts.

aSemy
  • 5,485
  • 2
  • 25
  • 51