Android Studio:从搜索结果中排除构建文件夹中的文件 [英] Android Studio : Exclude files in build folder from search result

查看:33
本文介绍了Android Studio:从搜索结果中排除构建文件夹中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Android Studio 项目,其中有多个模块,每个模块都依赖于一个共享模块.假设这个共享模块有一个 xml 文件调用 sample.xml

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

当我使用 Navigate -> Files... 搜索打开文件并输入sample.xml"时,我会得到

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

  1. 分享/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...

既然生成了 build 文件夹中的文件,我们不应该编辑它们,所以我没有理由要将它们包含在我的搜索结果中.无论如何我可以排除它们吗?

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?

推荐答案

简单地说,并从搜索中实际排除构建路径,您需要遵循 Frank 的回答点 1 和 2,然后因为没有合适的范围实际上排除构建文件夹,只需执行以下操作:

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:

在在路径中查找"内部对话框(CTRL+SHIFT+F):

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

  1. 点击 ... 以配置范围
  2. 点击+按钮,选择本地范围
  3. 为您的新范围命名
  4. 在模式中输入!file:build//*
  5. 点按确定"并测试您的新范围

如果您还想拥有单个模块的作用域,请为您的模块创建一个作用域(包括递归模块路径),然后将其添加到模式的开头:

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//*&&

例如,2 个模块的作用域:

For example, a scope for 2 modules:

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

阅读弗兰克的回答并从这里报告的问题中发布#7 后才得到完整答案:http://code.google.com/p/android/issues/detail?id=61488

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

这篇关于Android Studio:从搜索结果中排除构建文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆