Cannot resolve symbol 'Theme.AppCompat.Light.DarkActionBar' in styles.xml

Arun picture Arun · Apr 3, 2017 · Viewed 37.5k times · Source

Theme.AppCompat.Light.DarkActionBar is not compiling in styles.xml. I have added compile 'com.android.support:appcompat-v7:25.1.0' in app module's build.gradle. Theme Error

I have searched for solution in google. A lot of them are about changing the classpath in Project's build.gradle.Still its showing the same error.

build.gradle

dependencies {
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:support-annotations:25.1.0'
    compile 'com.android.support:cardview-v7:25.1.0'
    compile 'com.android.support:recyclerview-v7:25.1.0'
    //    compile 'ch.acra:acra:4.5.0'

    testCompile 'junit:junit:4.12'
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 25
        versionCode = 146
        versionName = "0.6.65"
    }

Answer

Maximilien Belinga picture Maximilien Belinga · Jul 3, 2017

Your build.gradle version is simply the wrong one.

Follow these instructions to fix that:

  • In Android studio, go to the Gradle scripts section in the left panel.
  • Find the file: build.gradle(Project:{your_project_name})
  • In that file look at the line com.android.tools.build:gradle
  • Check that the version match with your android studio version (for instance 2.3.3). This implies that com.android.tools.build:gradle:2.3.3 and And an Android studio distribution with 2.3.3 as version.
  • Validate the versions are the same. If it's not the case, make sure they match.
  • Rebuild the project and everything is fine!