Last active
March 6, 2022 19:09
-
-
Save mitchtabian/e5e9b476764cdb7b139a14cb642325b0 to your computer and use it in GitHub Desktop.
Basics #1: Preparing to use Hilt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Application | |
import dagger.hilt.android.HiltAndroidApp | |
@HiltAndroidApp | |
class MyApplication : Application(){ | |
override fun onCreate() { | |
super.onCreate() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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