Error: cannot find symbol variable DaggerAppComponent

后端 未结 8 1788
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-19 08:50

While trying to integrate latest Dagger 2 version, I am facing problem of Dagger auto generation. Dagger is not auto generating DaggerAppComponent in spite of several Rebuilds a

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 09:20

    I had the same problem...What solved my problem was actually adding The view model to the ViewmodelModulle then add the annotation @Inject to the constructor of my view model. It could be a different issue for you but in my situation, this really helped. My code compiled without any problem

    @Inject <----- This was Missing in the constructor.

    public MessageViewModel(Application application) {
        super(application);
        mApp = application;
    

提交回复
热议问题