Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- apply plugin: 'kotlin-kapt'
- //Dagger2
- api "com.google.dagger:dagger:$dagger_version"
- kapt "com.google.dagger:dagger-compiler:$dagger_version"
- api "com.google.dagger:dagger-android:$dagger_version"
- api "com.google.dagger:dagger-android-support:$dagger_version" // if you use the support libraries
- kapt "com.google.dagger:dagger-android-processor:$dagger_version"
- //////////////////////
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
- buildscript {
- ext.kotlin_version = "1.4.0"
- repositories {
- google()
- jcenter()
- mavenCentral()
- }
- dependencies {
- classpath "com.android.tools.build:gradle:4.0.1"
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
- }
- allprojects {
- repositories {
- google()
- jcenter()
- mavenCentral()
- }
- }
- task clean(type: Delete) {
- delete rootProject.buildDir
- }
- ///////////////////////////////////
- @Component(modules = [ViewModelModule::class])
- @Singleton
- interface DiAppComponent {
- fun getMainViewModel2(): MainViewModel
- }
- //////////////////////////////////
- class MainViewModel @Inject constructor() : BaseViewModel() {
- /////////////////////////////////
- @Module
- class ViewModelModule {
- @Provides
- @Singleton
- fun getMainViewModel(): MainViewModel {
- return MainViewModel()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment