Skip to content

Instantly share code, notes, and snippets.

@mitchtabian
Last active March 6, 2022 19:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchtabian/e5e9b476764cdb7b139a14cb642325b0 to your computer and use it in GitHub Desktop.
Save mitchtabian/e5e9b476764cdb7b139a14cb642325b0 to your computer and use it in GitHub Desktop.
Basics #1: Preparing to use Hilt
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'kotlin-kapt'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
def hilt_version = "2.28-alpha"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
def retrofit = "2.6.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
kapt {
correctErrorTypes true
}
import android.app.Application
import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
class MyApplication : Application(){
override fun onCreate() {
super.onCreate()
}
}
mavenCentral()
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment