Android – Cannot resolve symbol ‘Theme’ in styles.xml (Android Studio)

androidandroid-appcompatandroid-studioandroid-stylesgradle

Screenshot

Since today, Android Studio can't find the AppCompat themes in styles.xml, but for example AppCompatActivity in code does get recognized. My Android Studio version is 2.2.2, Build #AI-145.3360264

I already tried upgrading to the latest build tools, compile sdk (25) version etc. but it didn't fix the problem.

At the moment I have installed the following (from sdk manager):

  • android api: 19 and 23
  • sdk platform tools: 25.0.1
  • sdk tools: 25.2.3
  • build-tools: 23.0.2 and 25.0.1
  • support repository: 40
  • google repository: 39

and a few others, that shouldn't be necessary to list here.

build.gradle of app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.1'
    defaultConfig {
        applicationId "xxx.xxxxxxxx.xxxxxxxxx" //not the real applicationId
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {

        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/RootTools.jar')
    compile 'com.android.support:support-v4:23.+'
    compile 'com.android.support:support-v13:23.+'
    compile 'com.android.support:appcompat-v7:23.+'
    compile 'com.android.support:design:23.+'
    compile 'com.android.support:cardview-v7:23.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    compile 'de.hdodenhof:circleimageview:2.1.0'
}

Best Answer

Another solution that worked for me with Android Studio 3.1.2:

delete these from build.gradle if you have them:

'com.android.support:appcompat-v7:27.1.1' 'com.android.support:design:27.1.1'

then sync, then undo delete, then sync again.