局部变量或实例字段名称与正则表达式“ [az] +”不匹配

Yog*_*ity 5 regex android intellij-idea gradle android-studio

将Android Studio升级到后,将2.1.2旧项目导入到我的代码中时,就会出现警告。警告是:

Instance field name doesn't match regex '[a-z]+'
Local variable name doesn't match regex '[a-z]+'
Instance field access is not qualified with 'this'
Run Code Online (Sandbox Code Playgroud)

这是屏幕截图。

局部变量或实例字段名称与正则表达式“ [az] +”不匹配

如果我将同一类文件复制到另一个新项目,则不会出现警告。仅旧项目显示这些警告。这是我的build.gradle文件:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 10
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.1.0'
    compile 'com.android.support:design:24.1.0'
    androidTestCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)

我尝试过File menu -> Invalidate caches / Restart,但没有帮助。我想解决问题而不是忽略警告。任何帮助深表感谢。谢谢。

Sup*_*hne 5

您的检查配置文件已更改。您可以通过这种方式还原它。

  1. 转到检查 (右下角的脸)-> 配置检查文件->设置->编辑器->检查

在此处输入图片说明

  1. 您可以通过从左上角的下拉菜单中选择所需的配置文件来更改检查配置文件

要么

从列表中禁用所有不需要的检查。

要么

创建您自己的检查员资料。

在此处输入图片说明