Search code examples
javaandroidandroid-studioimportandroid-studio-import

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.


Solution

  • 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

    enter image description here