The way of Android Project package management, the commendation is Composing Build
+ Version catalogs.
Build Logic
is the production that Referring nowinandroid
with my experience in Android Project.
You can use it as submodule in your project that can reduce lot of your gradle configuration code.
Provides many plugins that category of feature/functional..., also can combine multi plugins for your module's variety.
-
Using as submodule in your project in a git initialed project, run command line as below:
git submodule add https://github.com/BreakZero/build-logic
-
Creating version catalog file
- create a file named
libs.versions.toml
under gradle folder - add
versionCatalogs
block configuration into settings.gradle.kts file withindependencyResolutionManagement
dependencyResolutionManagement { repositories { *** } versionCatalogs { create("easy") { from(files("./build-logic/building.versions.toml")) } } }
Note: You also can use plugin id directly without doing this step. Plugin id see building.versions.toml
There are some common libraries provided in catalogs, version maybe older, update if you need
- create a file named
-
Sync project and using that you need
- Plugin usage
plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.android.library) apply false alias(libs.plugins.kotlin.android) apply false }
plugins { id("org.easy.android.application.compose") id("org.easy.jacoco") id("org.easy.hilt") }
- Dependencies usage
dependencies { implementation(libs.core.ktx) implementation(libs.androidx.compose.activity) }
Here is an Example
There are some config fields could not move to Main Project such as compileSdkVersion
、targetSdkVersion
、versionCode
...
But you also can override it in module configuration file.
Actually, i don't recommend do in that way. In Android Project, we don't care about the Library module
version code, so we
do not need manage it in specially. Just override in app module.
- Chinese README_CN.md