Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio : Exclude files in build folder from search result

I have an Android Studio project in which I have multiple modules, each of those module depending on a share module. And let's say that this share module has an xml file call sample.xml

When I search to open file with Navigate -> Files... and type "sample.xml", I'll get

  1. Share/src/main/res/values/sample.xml
  2. ModuleA/build/intermediates/exploded-arr/.../res/values/sample.xml
  3. ModuleB/build/intermediates/exploded-arr/.../res/values/sample.xml
  4. ModuleC/build/intermediates/exploded-arr/.../res/values/sample.xml
  5. ModuleD/build/intermediates/exploded-arr/.../res/values/sample.xml ...

Since the files in build folder are generated and we shouldn't edit them, there is no reason why I want to include them in my search result. Is there anyway I can exclude them?

like image 216
Tar_Tw45 Avatar asked Mar 09 '15 08:03

Tar_Tw45


People also ask

Can I delete build folder Android studio?

Yes, you can delete the Build folder. If you are running Windows and you are not able to delete the folder, make sure you are the owner of the folder. Go to folder properties/security and check if your name is listed as the owner.

What is exclude file?

If you exclude a file from a Web Site project (not Web Application), Visual Studio will simply add the . exclude extension to that file. If you remove the extension, that file will be included again. It's up to you if you still need those files or not.


1 Answers

To put it simply, and to actually exclude build paths from your search, you need to follow Frank's answer point 1 and 2, then because there's no suitable scope that actually exclude the build folder, simply do this:

Inside the "Find in Path" dialog (CTRL+SHIFT+F):

  1. tap the ... to configure a scope
  2. click the + button, choose local scope
  3. give your new scope a name
  4. enter !file:build//* in the pattern
  5. tap OK and test your new scope

enter image description here If you further want to have a scope for a single module, create a scope for your module (including recursively your module path), then add this at the beginning of your pattern:

!file:build//*&& 

For example, a scope for 2 modules:

!file:build//*&&file[MODULE1_DIRECTORY_NAME]:*/||file[MODULE2_DIRECTORY_NAME]:*/ 

Only got the full answer reading Frank's answer and post #7 from issue reported here: http://code.google.com/p/android/issues/detail?id=61488

like image 175
3c71 Avatar answered Sep 19 '22 21:09

3c71