如何在Android Studio IDEA中找到我项目中所有未使用的方法?

问题描述:

如何在Android Studio IDEA中找到我项目中所有未使用的方法和变量?

How can I find all unused methods and variables of my project in the Android Studio IDEA?

在android工作室中(或者更常见地在Intellij IDEA中)您可以从 分析 - >检查代码... 指定要分析的检验代码然后定义代码的范围。
您可以在下图中看到我的代码的结果:

In the android studio(or more generally in the Intellij IDEA) you can specify inspection code that you want to analyze from Analyze->Inspect Code... and then define the scope of your code. You can see the result for my code in the below picture:

声明冗余 中,您可以看到someMethod被声明为未使用。此外,在 可能的错误 中,您可以找到变量 i 从未使用过。

In Declaration redundancy you can see that "someMethod" is declared unused. Also, in Probable bugs you can find variable i is never used.