Report unused imports as error in Android Studio or IntelliJ
问题 Is there any way/setting in Android Studio to report the unused imports in java files as error? In Eclipse, lint reported this as error pretty easily. 回答1: Applies to Android Studio and IntelliJ You could go to File/Settings then browse to Editor/Inspections/Import. Change Severity of Unused Import to Error 回答2: try this. its automatically remove unused imports yourProject --> Right Click --> Optimize Imports lint : its also show unused imports in java files as error yourProject --> Right