简体   繁体   English

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

[英]How can I find all unused methods of my project in the Android Studio IDE?

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

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.在android studio(或更一般地在Intellij IDEA)中,您可以从Analyze->Inspect Code...指定要分析的Analyze->Inspect Code... ,然后定义代码的范围。 You can see the result for my code in the below picture:您可以在下图中看到我的代码的结果:

在此处输入图片说明

In Declaration redundancy you can see that "someMethod" is declared unused.Declaration redundancy您可以看到“someMethod”被声明为未使用。 Also, in Probable bugs you can find variable i is never used.此外,在Probable bugs您会发现从未使用过变量i

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.在 QAPlug 中集成了 PMD、FindBugs、Checkstyle 和 Hammurapi。 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.如果您为更大的项目工作,我强烈推荐这些工具。

Nowadays its in Analyze->Inspect Code... and then you need to go to Kotlin |现在它在分析->检查代码...然后你需要去Kotlin | Redundant contructs |冗余结构 | Unused symbol未使用的符号

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM