Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress "Identifier not allowed in Android"

For my application written in Kotlin I use backticked method names for tests, like this:

fun `API login error - don't save token or user`() { 

It works, the tests compile and work without a problem, but Lint in Android Studio is marking those methods as error with message Identifier not allowed in Android.

Is there any way to suppress this so that the Lint check passes without errors and it's not marked with red underline in Android Studio?

like image 506
Michał Klimczak Avatar asked Feb 27 '17 11:02

Michał Klimczak


2 Answers

Based on wnc_21 answer I found that it can be disabled for a specific scope, in my case it's only used in tests so there's that.

Android Studio disable inspection for tests scope

like image 161
Michał Klimczak Avatar answered Sep 28 '22 22:09

Michał Klimczak


I am not sure if you can do it in code, but you can at least disable it in the IDE. Go to "File | Settings | Editor | Inspections | Illegal Android Identifier" and disable this inspection.

like image 41
wnc_21 Avatar answered Sep 28 '22 22:09

wnc_21