I have used the lint(Analyze->Inspect Code...) and find out unused methods and resources. All the unused resources removed by Refractor->Remove unused Resources but not found any option like this to remove java classes and methods. Is there any feature in the android studio or any Plugin which can remove all the java classes, the methods which are not used in code to save manual refracting?
In Android Studio Menu > Refactor > Remove Unused Resources... Select the resources you want to remove. You can exclude resources you want to keep by right-clicking on the resource item. Use Do Refactor to remove all Resources at once.
“remove unused resources android studio” Code Answer Just press Ctrl Alt Shift i and type "unused resources" (without quotes). That will execute lint.
Android Studio -> Preferences... -> Plugins -> Browse Repositories -> QAPlug.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With