10

Error Snap

build.gradle file

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "io.dume.dume"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso- 
 core:3.0.2'
 }

I just created a new projects and found this error dramatically on activity_main.xml i did not changed anything . Is there any Fix?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

5 Answers5

21

I had the same problem. Seems it is a Android Studio bug.

In your styles xml-file change this:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to this:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Works for me.

Anton Prokopov
  • 639
  • 6
  • 27
3

Set your target sdk version to 27 . Set your compile sdk version to 27 . And app compat version from 28.0.0-alpha3 to 27.1.1 .

If you still want to use sdk version 28

Just replace alpha3 to alpha1 without changing anything else

Jaswant Singh
  • 9,900
  • 8
  • 29
  • 50
1

This worked for me when that happened, I dont know why it doesn't work with 28:

//use this instead 
compileSdkVersion 27
buildToolsVersion '27.0.3'
targetSdkVersion 27

dependencies{

//switch to these
implementation 'com.android.support:appcompat-v7:27.0.0-alpha'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.0.0'

}
S. Cap
  • 11
  • 1
0

I fix this error using 3 methods on YouTube

Solution

duyuanchao
  • 3,863
  • 1
  • 25
  • 16
-1

This worked for me.

Open, res --> values --> styles.xml, here you will find a line like this:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

change it to:

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

In otherwords, change DarkActionBar to NoActionBar

Yusuf Adefolahan
  • 312
  • 2
  • 11