忽略查找结果中的R.java文件 [英] Ignore R.java files in Find results

查看:78
本文介绍了忽略查找结果中的R.java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行在路径中查找"(Ctrl + Shift + F)时,通常会在R.java文件的在生成的代码中使用"下获得结果.当我搜索代码时,我只想这样做:搜索我的代码.不是我的代码生成的文件.

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.

是否可以使查找对话框在结果中不显示任何R.java文件?我想要的唯一结果是发现的事件"下的那些结果

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"

谢谢!

推荐答案

Android Studio(如其祖先IntelliJ)允许您定义自定义范围,以帮助您在搜索时排除中间文件.

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:

  1. 打开在路径中查找"对话框(在我的计算机上为Ctrl + Shift + F).
  2. 在作用域"区域中,选择自定义"单选按钮.然后点击下拉菜单右侧的"..."按钮.这会打开作用域"对话框.
  3. 单击作用域"对话框左侧的"+"按钮,将弹出添加新作用域"对话框.将其命名为"ExcludeIntermediates".
  4. 在图案"字段中,粘贴以下图案,然后单击确定":

  1. Bring up Find in Path dialog (Ctrl+Shift+F on my machine).
  2. In the Scope area, select the Custom radio button. Then tap the "..." button on the right side of the dropdown. This brings up the Scopes dialog.
  3. Click the "+" button on the left side of the Scopes dialog, which will bring up the Add New Scope dialog. Name it "ExcludeIntermediates".
  4. In the Pattern field, paste in the following pattern and click OK:

!file:*intermediates*/&&!file:*generated*/

此模式不包括R.java文件和其他中间组件,例如爆炸的aar中的布局文件和filtered_manifests文件夹中的AndroidManifest.xml副本.

This pattern excludes R.java files and other intermediates such as layout files in exploded-aar and AndroidManifest.xml copies in filtered_manifests folders.

这篇关于忽略查找结果中的R.java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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