Automatically delete declared variable declarations - Android Studio / Inteiij

Is there a way to remove all unused field ads automatically in Android Studio / Intellij?

+7
android studio
source share
2 answers

Choose Analyze > Run Inspection by Name... , type in unused declaration and confirm with Enter . When the search is complete, select unused declaration on the results tab, right-click and select Safe delete :

enter image description here

+8
source share

Simple, just press ctrl + alt + shift + i and enter an unused declaration. You can also use this when deleting other unused resources, for example, press ctrl + alt + shift + i and enter unused resources. When the search is complete, select "Unused Ad" on the results tab, right-click and select "Secure Deletion"

+2
source share

All Articles