Remove all unused classes,methods from Android Studio project

前端 未结 3 1775
遇见更好的自我
遇见更好的自我 2021-01-31 14:48

I have used the lint(Analyze->Inspect Code...) and find out unused methods and resources. All the unused resources removed by Refractor->Remove unused R

3条回答
  •  粉色の甜心
    2021-01-31 15:30

    This can be achieved by using the built-in inspection Java | Declaration redundancy | Unused declaration.

    To run it on whole project go to Analyze -> Run inspection by name..., type Unused declaration and select desired scope. Then carefully check output and mark some classes as entry points if needed.

    Now you can select Unused declaration node in list and perform Safe delete action on all unused declarations at once.

    For Kotlin there is similar inspection Kotlin | Redundant constructs | Unused symbol.

提交回复
热议问题