Streamline your Android project configurations with reusable build logic setups. Designed for multi-module projects, this setup reduces boilerplate, standardizes configurations, and simplifies publishing with Gradle.
This repository provides a centralized setup for Android build configurations. The conventions include:
- Standardized build configurations across Android libraries, apps, and Compose modules.
- Automatic subproject plugin application based on project type (e.g., app, library).
- Streamlined publishing settings with GitHub Packages.
To integrate this build logic into your Android project, follow the steps below.
Add the custom plugin repository to your root project settings.gradle.kts
:
pluginManagement {
repositories {
maven(url = "https://maven.pkg.github.com/Kt-Kraft/build-logic/") {
name = "GitHubPackages"
credentials {
username = providers.gradleProperty("github.username").orNull
?: System.getenv("GITHUB_USERNAME")
password = providers.gradleProperty("github.token").orNull
?: System.getenv("GITHUB_TOKEN")
}
}
google()
mavenCentral()
gradlePluginPortal()
}
}
Add plugin aliases and configurations in your root project’s build.gradle.kts
:
plugins {
alias(libs.plugins.convention.android.app) apply false
alias(libs.plugins.convention.android.lib) apply false
alias(libs.plugins.convention.compose.app) apply false
alias(libs.plugins.convention.compose.lib) apply false
alias(libs.plugins.convention.publishing) apply false
alias(libs.plugins.convention.android.config)
alias(libs.plugins.convention.publish.config)
}
// Initial configuration for subprojects
convention {
android {
minSdk.set(26)
targetSdk.set(34)
compileSdk.set(34)
}
publishing {
pom {
setGitHubProject {
owner = "indramahkota"
repository = "easy-android"
}
licenses { mit() }
developers {
developer(
id = "indramahkota",
name = "Indra Mahkota",
email = "indramahkota1@gmail.com",
)
}
}
}
}
In your submodule build.gradle.kts
files, apply the necessary plugins:
plugins {
alias(libs.plugins.convention.compose.app)
alias(libs.plugins.secret.gradle.plugin)
}
// or
plugins {
alias(libs.plugins.convention.android.lib)
alias(libs.plugins.convention.publishing)
}