Can not resolve symbol for dagger component in android

我是研究僧i 提交于 2019-12-10 13:38:16

问题


I'm trying to add Dagger2 to my project in Android Studio.

This is my dependencies.

compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
provided 'javax.annotation:jsr250-api:1.0'

I am following this example.

https://guides.codepath.com/android/Dependency-Injection-with-Dagger-2#advantages

I am getting this error.

Can not resolve symbol DaggerNetComponent

I tried changing dependencies and other solution found after googling. but no luck.

Can anyone help me on this?


回答1:


The DaggerNetComponent is generated after compilation. You should enable annotation processing in compilation to generate that file. This link has the details.

These generated file should be added to the source path of the project to get recognized.



来源:https://stackoverflow.com/questions/41268890/can-not-resolve-symbol-for-dagger-component-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!