如何将Android Studio代码分析器设置为不返回数千个拼写错误?

not*_*bit 8 android-studio

我正在使用Android Studio(AS)3.3.2尝试恢复旧项目。运行Analyze > Inspect code...意外返回几乎所有内容的大量拼写错误(〜8000),而没有区别什么是代码,注释或XML属性等。

在以前的项目中,我从未遇到过这个问题,而且看起来AS很聪明,可以在进行拼写检查时分离代码,变量等。现在看起来像这样:

在此处输入图片说明

如您所见,还有其他问题。例如,在Gradle缓存和看似来自构建中间件的属性文件中:

..\\app\\build\\intermediates\\res\\merged\\debug\\drawable-ldrtl-xxhdpi-v17_abc_ic_menu_copy_mtrl_am_alpha.png.flat
Run Code Online (Sandbox Code Playgroud)

我也试图disable 'Typos'app/build.gradle下面lintOptions{}没有任何效果。(似乎这被忽略了。)

我如何调整它的行为以理智的方式?
(我不想关闭拼写检查。)

den*_*lor 6

"URI is not registered" could be for a few reasons such as:

  • you have added manually activity_emergency_number.xml while being in a specific build variant and it could have been missing some linking configurations for other build variants. A solution here is to try to switch build variants to make Android Studio reload configuration linking.
  • Misleading linking between resources in your Intellij Idea cache. A solution could be to Invalidate and Restart Cache.
  • The folder structure of where activity_emergency_number.xml is located
  • Add your url through Preferences > Languages & Frameworks > Schemas and DTDs > Add(+) > Apply > Ok
  • activity_emergency_number.xml missing header line <?xml version="1.0" encoding="utf-8"?>
  • When you have multiple flavors, make sure that your current selected build variant matches the flavor for the layout activity_emergency_number.xml
  • your attributes in activity_emergency_number.xml views are missing some prefix like android: or have some prefix that aren't needed fr those attributes

About ignoring some spelling typo in situations such as code variables and not ignoring them in other situations such as comments, you have those options available to tune together as well with the Scope you are interested (Production, Test, Project Source Files, Project Files..) in:

Android Studio > Preferences > Editor > Inspections > Spelling > Typo

Here you have two things:

  • Severity (where you define also the Scope)
  • Options
    • Process Code (unselect this to not check typos in code variables)
    • Process Literal (this one you have to try if you will need it)
    • Process Comments (keep this selected to check typos in comment)

在此处输入图片说明