Home » Android » intellij idea – Android Studio: How to stop getting error marks on unused symbols

intellij idea – Android Studio: How to stop getting error marks on unused symbols

Posted by: admin June 15, 2020 Leave a comment

Questions:

In any code, i guess, there are variables/method/classes that are really not used and maybe just there for show/just in case.

Anyway, How do i set Android Studio to stop giving me the ‘yellow’ error stripe marks in the scrollbar for unused variables. Although, i don’t want to stop getting warnings all together.

How to&Answers:

Fount it!

Right click the scroll bar > Customize Highlight Level > Configure inspections. You’ll find an immense list, type-in the search field for unused then you’ll see “Unused Symbol”, unchecked it.

Answer:

add SuppressWarnings annotation at the methods/variables/classes which are unused…

@SuppressWarnings("unused")
private String unusedString;

@SuppressWarnings("unused")
private void unusedMethod() {

}

@SuppressWarnings("unused")
private class UnUsedClass {

}

Answer:

Highlight Level android studio

You can change highlighting level by clicking the button at the right corner in android studio.