Android Dagger Hilt Example
- Navigation Component - Single Activity, four fragments.
- Dagger Hilt - Dependency Inject (alpha library)
root project gradle
dependencies {
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'
}
allprojects {
maven {
url "https://androidx.dev/snapshots/builds/6543454/artifacts/repository/"
}
}
app module gradle
apply plugin: 'dagger.hilt.android.plugin'
dependencies {
implementation "com.google.dagger:hilt-android:2.28-alpha"
kapt "com.google.dagger:hilt-android-compiler:2.28-alpha"
implementation 'androidx.hilt:hilt-common:1.0.0-SNAPSHOT'
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-SNAPSHOT'
kapt 'androidx.hilt:hilt-compiler:1.0.0-SNAPSHOT'
}