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

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

问题描述:

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

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

在 android studio(或更一般的 Intellij IDEA)中,您可以从 Analyze-&gt 中指定要分析的检查代码;Inspect Code... 然后定义代码的范围.您可以在下图中看到我的代码的结果:

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"被声明为未使用.此外,在 Probable bugs 中,您可以发现从未使用过的变量 i.

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