Java 如何在 Android Studio IDE 中找到我项目中所有未使用的方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33674592/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I find all unused methods of my project in the Android Studio IDE?
提问by Hamed Ghadirian
How can I find all unused methods and variablesof my project in the Android Studio IDE?
如何在Android Studio IDE 中找到我项目中所有未使用的方法和变量?
采纳答案by Hamed Ghadirian
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:
在 android studio(或更一般地在 Intellij IDEA 中)中,您可以指定要从中分析的检查代码,Analyze->Inspect Code...
然后定义代码的范围。您可以在下图中看到我的代码的结果:
In Declaration redundancy
you can see that "someMethod" is declared unused. Also, in Probable bugs
you can find variable i
is never used.
在Declaration redundancy
你可以看到“someMethod”被声明为未使用。此外,Probable bugs
您可以找到i
从未使用过的变量。
回答by Erythrozyt
You can also install the QAPlug via File -> Settings -> Plugins -> Browse Repositories -> QAPlug
.
您也可以安装QAPlug via File -> Settings -> Plugins -> Browse Repositories -> QAPlug
.
For Mac:
对于 Mac:
Android Studio -> Preferences... -> Plugins -> Browse Repositories -> QAPlug.
In QAPlug is PMD, FindBugs, Checkstyle and Hammurapi integrated. These tools are very nice to find dead code, bugs, increase performance and make the code more readable. I highly recommend those tools if you work for a bigger project.
在 QAPlug 中集成了 PMD、FindBugs、Checkstyle 和 Hammurapi。这些工具非常适合查找死代码、错误、提高性能并使代码更具可读性。如果您为更大的项目工作,我强烈推荐这些工具。