Anyone with experience using includeBuild() with c...
# android
z
Anyone with experience using includeBuild() with custom plugins or external plugins? Facing some weird issues when I apply the plugin to my application
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
com/android/build/gradle/AppExtension
> com.android.build.gradle.AppExtension

* Exception is:
java.lang.NoClassDefFoundError: com/android/build/gradle/AppExtension
	at com.guardsquare.dexguard.gradle.DexGuardPlugin.apply(DexGuardPlugin.kt:47)
	at com.guardsquare.dexguard.gradle.DexGuardPlugin.apply(DexGuardPlugin.kt:27)
    ....
Caused by: java.lang.ClassNotFoundException: com.android.build.gradle.AppExtension
	... 195 more
v
Can you provide an MCVE?
z
Copy code
open class DexguardAddonPlugin : Plugin<Project> {

    override fun apply(target: Project) {
        target.apply<DexGuardPlugin>()
        target.plugins.withId("com.android.application") {
            target.extensions.configure<DexGuardExtension> {
                version = Dependencies.Plugins.dexguardVersion
                configurations.register(BuildType.DEBUG) {
                    defaultConfigurations("<http://dexguard-debug.pro|dexguard-debug.pro>")
                    configuration("dexguard-debug-project.txt")
                }
                jvmArgs("-Xmx2048M", "-Dallow.incomplete.class.hierarchy=true")
            }
        }
    }
}
Turns out I needed to create the plugin and apply it after
com.android.application
plugin it this way for it to work.