When I do a Find in Path (Ctrl+Shift+F), I often get results under "Usages in Generated Code" in R.java files. When I'm searching my code, I want to do just that: search my code. Not files generated by my code.
Is it possible to get the find dialog to not show any R.java files in the results? The only results I want are those under "Found Occurrences"
Thank you!
Android Studio (like its progenitor IntelliJ) allows you to define a custom scope to help you exclude intermediates files when searching.
Here are the steps I use to set this up:
In the Pattern field, paste in the following pattern and click OK:
!file:*intermediates*/&&!file:*generated*/
This pattern excludes R.java files and other intermediates such as layout files in exploded-aar and AndroidManifest.xml copies in filtered_manifests folders.
This pattern excludes R.java files and other intermediates such as layout files in exploded-aar and AndroidManifest.xml copies in filtered_manifests folders.
includes all xml files in layout/* path
!file:*intermediates*/&&!file:*generated*/&&file:*java&&!file:R.java&&!file:*_.java||file:*strings.xml||file:*dimes.xml||file:*styles.xml||file:*attrs.xml||file:*colors.xml||file:*layout/*xml&&!file:*build/*xml
Combined from:
https://stackoverflow.com/a/32238593/1815624
&
https://stackoverflow.com/a/32680493/1815624
To search multiple modules but ignore R.java, you could use the following mask IF you don't have any other single character file names in your project:
☑ File mask(s): ??*.*
i.e. Limit results to filenames with at least 2 characters + any extension.
If you're using Android Studio, a simple way of achieving this is to set the Scope to be Directory (rather than Whole Project) and set this directory to be your src folder - since R.java appears under build/generated it won't appear in results there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With