Initialization Framework for Android Application
Initializr
A framework for app initialization.
Getting Started
Configuring booster plugin and initializr booster plugin:
buildscripts {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:${agpVersion}")
classpath("com.didiglobal.booster:booster-gradle-plugin:${boosterVersion}")
classpath("io.johnsonlee.initializr:compiler:${initializrVersion}")
}
}
Then, applying plugins:
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("com.didiglobal.booster")
}
Then, configuring initializr compiler and runtime library:
dependencies {
kapt("io.johnsonlee.initializr:compiler:${initializrVersion}")
implementation("io.johnsonlee.initializr:runtime:${initializrVersion}")
}
Example
PrimaryInitializer
@Initialization(
name = "PrimaryInitializer",
dependencies = []
)
class PrimaryInitializer : Initializer {
@WorkerThread
override fun initialize(context: Context) {
}
}
SecondaryInitializer
@Initialization(
name = "SecondaryInitializer",
dependencies = ["PrimaryInitializer"]
)
class SecondaryInitializer : Initializer {
@WorkerThread
override fun initialize(context: Context) {
}
}
MyApplication
class MyApplication: Application() {
fun onCreate() {
super.onCreate()
Initiator.init(this)
}
}