如何告诉 Android Studio 对本机代码不那么迂腐

How to tell AndroidStudio to be less pedantic about native code

我正在使用带有 C 和 C++ 代码的基于 AndroidStudio to build NDK 的应用程序。

IDE 过度警告,如下所示:

如何禁用来自 IDE 的这个和其他无故警告? 这是在每个项目的基础上完成的,还是 IDE 设置? 无论如何,大量警告无济于事。

Android Studio 状态的发行说明:

Android Studio now includes support for static code analysis using Clang-Tidy for projects that include native code. To enable support for Clang-Tidy, update your NDK to r18 or higher. You can then enable or re-enable the inspections by opening the Settings or Preferences dialog and navigating to Editor > Inspections > C/C++ > General > Clang-Tidy. When selecting this inspection in the Settings or Preferences dialog, you can also see the list of Clang-Tidy checks that are enabled and disabled under the Option section of the right-most panel.

要禁用警告,只需转到:

Preferences->Editor->Inspections->C/C++->General->Clang-tidy

并取消选中 Clang-tidy 或编辑检查列表以禁用那些让您烦恼的检查。