Skip to content Skip to sidebar Skip to footer

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 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

enter image description here

Solution 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 Click --> Analize --> Inspect Code

Solution 3:

First remove references of these imports from the code. Then you can use this shortcut ALT + CTRL + O

Post a Comment for "Report Unused Imports As Error In Android Studio Or Intellij"