Reputation: 831
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
.
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"
}
Upvotes: 34
Views: 47187
Reputation: 11
Try to do Refactor > Migrate to AppCompat.... It worked for me
Upvotes: 1
Reputation: 9061
My theme parent was android:Theme.Light
and I wanted to change it to the AppCompat version. I mistakenly changed it to android:Theme.AppCompat.Light
, but instead I needed to change it to Theme.AppCompat.Light
.
Upvotes: 0
Reputation: 9228
Go to File > Close the Project. Then import it back and restart Android Studio.
Upvotes: 21
Reputation: 924
In my case it was due to wrong gradle version in gradle-wrapper.properties.
distributionUrl=https://services.gradle.org/distributions/gradle-5.0-all.zip
Upvotes: 0
Reputation: 58934
This solution worked for me
Error should be resolved now.
If that fails, try below-
appcompact-v7
dependency and sync project.appcompact-v7
dependency and sync.Issue solved!
Upvotes: 0
Reputation: 28793
I tried many solutions, including deleting of .gradle
folder (yes, it works, a project becomes compilable), but red themes didn't disappear.
This advice helped:
.idea
directorycaches
and libraries
directoriesUpvotes: 0
Reputation: 111
I have this problem and it is because in my new style and it is because when I declare a new style I put "Theme.AppCompat.Light.NoActionBar" in the name instead of parent. I change from :
<style name="Theme.AppCompat.Light.NoActionBar" />
to
<style name="ThisTheme" parent="Theme.AppCompat.Light.NoActionBar"/>
Upvotes: 0
Reputation: 107
Just remove and add this below lines again in build.gradle i.e. app.gradle and sync it:
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
as per your android version.........
Upvotes: -1
Reputation: 5753
This works for me.
Upvotes: 0
Reputation: 498
Maybe you can try one of the following solutions:
.gradle
folder under the projectminSdkVersion
in app/build.gradle
, eg. 14 or 16, which is greater than 8 !minSdkVersion
& targetSdkVersion
configuration in AndroidManifest.xml
!com.android.support:appcompat-v7
library in app/build.gradle
Upvotes: 1
Reputation: 7708
I had the same issue in Android 3.0.1, tried doing "Synchronize", Resysnching gradle etc but nothing helped, I then found that adding
implementation 'com.android.support:design:27.0.2'
line fixed the issue
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:support-compat:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Upvotes: 0
Reputation: 1
The fix for me was to delete the .gradle folder in my project root, then click file and click "Synchronize". everything worked after that.
Upvotes: -1
Reputation: 5249
I did everything as has been suggested in the accepted answer and it didn't help. Then I did everything as has been suggested in this answer: Android studio cannot find Theme.AppCompat.Light.DarkActionBar (enabled all components in Repository) and it didn't help either.
The issue has been only resolved after clicking on "Synchronized" in File menu. I'm running Android 3.0.1 on Mac.
Upvotes: 0
Reputation: 1504
I have noticed that all themes available with the prefix @android:style/
can be used. So, I have solved this issue by replacing
Theme.AppCompat.Light.DarkActionBar
with
@android:style/Theme.DeviceDefault.Light.DarkActionBar
Upvotes: 9
Reputation: 803
<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.
Upvotes: 10
Reputation: 3186
Your build.gradle version is simply the wrong one.
Follow these instructions to fix that:
build.gradle(Project:{your_project_name})
com.android.tools.build:gradle
com.android.tools.build:gradle:2.3.3
and And an Android studio distribution with 2.3.3 as version.Upvotes: 40
Reputation: 12347
I had the exact same problem, what fixed it for me was retrograding gradle plugin:
buildscript {
repositories {
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
Followed by a project sync with gradle files to clear the problem.
Upvotes: 3
Reputation: 508
Change in style.xml file as <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"></style>
Upvotes: 0
Reputation: 1672
Check your build.gradle file , set compileSdkVersion to 25 . Following gradle is working for me with appcompat-v7:25.1.0'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "xxx.xx.xxxxx"
minSdkVersion 16
targetSdkVersion 21
versionCode 26
versionName "3.16"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.android.support:appcompat-v7:25.1.0'
}
Upvotes: 0
Reputation: 488
compile 'com.android.support:appcompat-v7:23.4.0'
try this
Upvotes: 0