Gradle - 8.2.1, AGP - 8.0.2, Kotlin - 1.9.0
buildSrc/build.gradle.kts
plugins {
`kotlin-dsl`
}
dependencies {
implementation("com.android.tools.build:gradle-api:8.0.2")
}
gradle/support/common-app-config.gradle.kts
plugins {
id("com.android.application")
...
}
android {
...
}
dependencies {
implementation(project(":feature-one"))
implementation(project(":feature-two"))
...
}
Similarly, gradle/support/common-lib-config.gradle.kts
plugins {
id("com.android.library")
...
}
android {
...
}
dependencies {
implementation(project(":platform"))
...
}
Also, gradle/support/common-dependencies.gradle.kts
dependencies {
implementation("androidx", "lifecycle", "navigation"... )
/** You get the gist of this block **/
...
}
Is there a clean approach to centralizing the android {} blocks for application and library, separately is still fine, as well as dependencies {} block for re-use ?
So far, app/build.gradle.kts
apply {
from(file("${rootProject.projectDir}/gradle/support/common-app-config.gradle.kts"))
}
fails with "Unresolved reference : android", despite declaring the "com.android.application" plugin in the common-app-config.gradle.kts file.