How do I configure IntelliJ/gradle to use dagger 2.0

后端 未结 8 2319
野的像风
野的像风 2020-12-28 16:01

I have a gradle project and I want to use dagger 2.0 in it. I don\'t know how to configure IntelliJ and gradle to generate files and let IntelliJ find them?

My build

8条回答
  •  情书的邮戳
    2020-12-28 16:15

    In my case the problem was IDEA creating a separate module for the dagger generated files. I had to go to File -> Project Structure -> Modules and remove the projectname_dagger module (by clicking the red minus), then add the generated source folder to my projectname_main module by clicking Add Content Root and selecting it.

    The for some reason I had to delete Dagger's files and let IDEA regenerate them because I was getting errors about duplicate files in the project.

    Now it works, event with Annotation Processors being turned off (I suspect they must mainly be important for Android projects).

提交回复
热议问题