android - 抑制 "Identifier not allowed in Android"

标签 android android-studio kotlin android-lint

对于我用 Kotlin 编写的应用程序,我使用反引号的方法名称进行测试,如下所示:

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

它工作正常,测试编译并正常工作,但 Android Studio 中的 Lint 将这些方法标记为错误,并显示消息 Identifier not allowed in Android

有什么方法可以抑制这种情况,以便 Lint 检查通过而不会出现错误,并且在 Android Studio 中没有用红色下划线标记?

最佳答案

基于 wnc_21 答案,我发现它可以在特定范围内禁用,在我的情况下,它仅用于测试,所以就是这样。

Android Studio disable inspection for tests scope

关于android - 抑制 "Identifier not allowed in Android",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42485164/

相关文章:

android - 未使用 lambda 表达式

android - BindingAdapter 中的高阶函数

android - 跨多个 Android 版本实现 SharedPreferences

android - 在android中实现搜索

Android Studio 更新后的 Android Gradle CompilationFailedException

java - 为什么 Android Studio 自动导入内联类而不是在我的代码顶部?

android - 从两个列表中获取不常见的元素 - KOTLIN

java - 错误 :java. lang.OutOfMemoryError:超出 GC 开销限制

android - 如何为卡片 View 设置边框?

在 onDestroy() 方法上使用 android.os.Process.killProcess 时,Android 应用程序在启动时崩溃