问题
Is there a way to remove all unused field declarations automatically in Android Studio/Intellij ?
回答1:
Select Analyze > Run Inspection by Name..., type unused declaration and confirm with Enter. When the search is finished, select Unused declaration from the result tab, right click and select Safe delete:
回答2:
As simple as that, just press ctrl+alt+shift+I and type unused declaration. You can also use this in removing other unused resouces, for example press ctrl+alt+shift+I and type unused resources. When the search is finished, select Unused declaration from the result tab, right click and select Safe delete
来源:https://stackoverflow.com/questions/30669093/remove-unused-variable-declarations-automatically-android-studio-inteiij