A local variable or instance field name does not match the regular expression '[az] +'

After updating Android studio to 2.1.2 my code is littered with warnings when I imported my old project into it. Warnings:

 Instance field name doesn't match regex '[az]+' Local variable name doesn't match regex '[az]+' Instance field access is not qualified with 'this' 

Here is a screenshot.

A local variable or instance field name does not match the regular expression '[az] +'

If I copy the same class file to another new project, there will be no warnings. These warnings only warn the old project. Here is my build.gradle file:

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

I tried File menu -> Invalidate caches / Restart , this did not help. I would like to solve the problem and not ignore the warnings. Any help is much appreciated. Thanks.

+3
android regex intellij-idea android-studio gradle
source share
1 answer

The profile of your inspection has been changed. You can restore it this way.

  • Go to Inspections (bottom right corner of the face) β†’ Configure Inspections or File β†’ Settings β†’ Editor β†’ Inspections

enter image description here

  1. You can change the inspection profile by selecting the desired profile from the drop-down menu in the upper left corner.

or

Disabling any unwanted inspection from the list.

or

Create your own inspector profile.

enter image description here

+2
source share

All Articles