Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"
    }
like image 414
Arun Avatar asked Apr 03 '17 05:04

Arun


3 Answers

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!
like image 83
Maximilien Belinga Avatar answered Nov 17 '22 09:11

Maximilien Belinga


Go to File > Close the Project. Then import it back and restart Android Studio.

like image 26
eli Avatar answered Nov 17 '22 08:11

eli


<style name="Theme.Base.MyTheme" parent="Theme.AppCompat.Light.NoActionBar">

In case when clean/rebuild not work, just delete .gradle directory in your project root. And sync project with gradle again.

This issue is caused when you mix cache of your support libraries.

like image 10
kotoMJ Avatar answered Nov 17 '22 08:11

kotoMJ