Remove dagger generated classes from Android Studio's global search?


It is really irritating. I need more time to find some class because of dagger 2.


If you are talking about the generated MembersInjector and Factory classes:

you can prevent these from coming up in the Ctr-N or Cmd-O dialog by adding them to the ignored files list in File / Settings / Editor / FileTypes and adding the appropriate wildcards to the Ignore files and folders edittext:

the ignore files and folders dialog in IntelliJ

*; *; will cause most of the generated classes to be ignored:


before applying the settings


after applying the settings

You can even add Dagger*.java to the list if you don’t even want to see the generated component (even though this is rather useful for the project).


If you are talking about not having the classes appear in auto-import/auto-complete this is done through Settings / Editor / General / Auto Import:

auto import settings dialog in IntelliJ

Answered By – David Rawson

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published