nuhkoca
06/02/2022, 5:37 PMplugins
declaration. Applying below in the root Gradle file
plugins {
id("com.android.application") version "7.2" apply false
id("com.android.library") version "7.2" apply false
}
But I also need to apply Gradle
plugin in buildSrc
so I have this in there
implementation("com.android.tools.build:gradle:7.2.0")
but then IDE throws an exception
Error resolving plugin [id: ‘com.android.application’, version: ‘7.2.0’, apply: false]
> The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.How do I have the same plugin works for the both places?
Vampire
06/02/2022, 5:45 PMapply false
it is not applied but only added to class path anyway, so no point in doing it again. Alternatively you could switch from buildSrc
to composite build. I think with an included build the compatibility check should work.nuhkoca
06/02/2022, 6:03 PMVampire
06/02/2022, 6:07 PMnuhkoca
06/02/2022, 6:34 PMapp
module doesn’t compile
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun CompileOptions.debug(vararg debugArgs: Pair<String, Any?>): CompileOptions defined in org.gradle.kotlin.dslI use
debug
accessor for build type
buildTypes {
debug {
...
Vampire
06/02/2022, 8:23 PMAlbert Chang
06/03/2022, 1:10 AMimplementation
to compileOnly
in buildSrc. Also you can use com.android.tools.build:gradle-api
instead of com.android.tools.build:gradle
.nuhkoca
06/04/2022, 2:36 PMA problem occurred evaluating script.
> com/android/build/gradle/AppPlugin
Caused by: java.lang.NoClassDefFoundError: com/android/build/gradle/AppPlugin
I need AppPlugin
in one of classes in buildSrc
import com.android.build.gradle.AppPlugin
I changed implementation
to compileOnly
for com.android.tools.build:gradle
Albert Chang
06/04/2022, 5:24 PMcom.android.application
).