Android studio 未生成Dagger2应用程序组件(包括git项目)

Android studio 未生成Dagger2应用程序组件(包括git项目),android-studio,kotlin,dependency-injection,dagger-2,auto-generate,Android Studio,Kotlin,Dependency Injection,Dagger 2,Auto Generate,所以我试图遵循谷歌的架构,但我的daggerappcomponent并没有生成。我试图修改gradle文件,但我不确定我做错了什么。第一次做这样“高级”的事情(至少对我来说)。我注释掉了DI包中的所有内容,因为如果没有QuoteApplication,我无法让它工作,如果不构建项目并希望它生成必要的dagger文件,我也无法让QuoteApplication工作 override fun applicationInjector(): AndroidInjector<out Dagg

所以我试图遵循谷歌的架构,但我的daggerappcomponent并没有生成。我试图修改gradle文件,但我不确定我做错了什么。第一次做这样“高级”的事情(至少对我来说)。我注释掉了DI包中的所有内容,因为如果没有QuoteApplication,我无法让它工作,如果不构建项目并希望它生成必要的dagger文件,我也无法让QuoteApplication工作

    override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
        return DaggerApplicationComponent.factory().create(applicationContext) //here is the problem
    }
override fun applicationInjector():AndroidInjector{
return DaggerApplicationComponent.factory().create(applicationContext)//问题出在这里
}
这是项目
我尝试了很多不同的构建梯度,我尝试了清理和再闲置等等。我已经阅读了所有的在线修复,但没有任何效果。我肯定这是我的错,但可能是个bug什么的。我最后的办法是在这里问。这件事让我有点为难。

对我来说效果很好

  • 我建造
  • 组件已生成
  • buld失败,因为没有导入
  • 我导入新创建的组件(导入com.example.quoteappmvvm.di.DaggerApplicationComponent)
  • 它起作用了 包com.example.quoteappmvvm

    导入com.example.quoteAppMVM.di.DaggerApplicationComponent>>>您需要这个

    导入dagger.android.android喷射器

    导入dagger.android.support.DaggerApplication

    //open class QuoteApplication{
    ////    override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
    ////
    ////        return DaggerApplicationComponent.factory().create(applicationContext)
    ////    }
    //
    ////    override fun onCreate() {
    ////        super.onCreate()
    ////       // if (BuildConfig.DEBUG) Timber.plant(DebugTree())
    ////    }
    //}
    
    open class QuoteApplication : DaggerApplication() {
        override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
    
            return DaggerApplicationComponent.factory().create(this)
        }
    
        override fun onCreate() {
            super.onCreate()
           // if (BuildConfig.DEBUG) Timber.plant(DebugTree())
        }
    }
    
    //打开类QuoteApplication{
    ////重写有趣的applicationInjector():AndroidInjector{
    ////
    ////返回DaggerApplicationComponent.factory().create(applicationContext)
    ////    }
    //
    ////重写fun onCreate(){
    ////super.onCreate()
    //////if(BuildConfig.DEBUG)Timber.plant(DebugTree())
    ////    }
    //}
    开放类QuoteApplication:DaggerApplication(){
    重写有趣的applicationInjector():AndroidInjector{
    返回DaggerApplicationComponent.factory().create(此)
    }
    重写fun onCreate(){
    super.onCreate()
    //if(BuildConfig.DEBUG)Timber.plant(DebugTree())
    }
    }
    
    请提供一些错误消息。