6

I know this question has been asked a lot of times but I have tried most of the solutions, and none worked for me. This is the first time that I'm working on android studio 3.1.3, and I was following a tutorial on how to create a simple app using the basic template option from the android studio. The problem that I'm facing is; enter image description here

Render Problem Failed to find style 'coordinatorLayoutStyle' in current theme

I have tried adding this to the build.gradle file:

compile 'com.android.support:design:24.1.1'

Also this into the style.xml

<style name="AppTheme.NoActionBar">
  <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>


    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    Couldn't resolve resource @style/Widget.Design.CoordinatorLayout<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

build.gradle

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.notes"
        minSdkVersion 23
        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'
    implementation 'com.android.support:design:28.0.0-alpha3'
    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'
}
Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50
Pedro
  • 1,440
  • 2
  • 15
  • 36
  • 1
    [This](https://stackoverflow.com/a/49305312/7551190) helped me solve such similar problem. Give it a try – Kathir Nov 27 '18 at 06:50

5 Answers5

6

I was having the same problem. I tried following steps from here, but still the problem persists. I think it is a common issue in android studio 3.0+, Hopefully they will fix it next update. In the Android Studio Preview 3.2 it works fine. Download Android Studio Preview and visit here to learn how to run it alongside with Android Studio stable version

enter image description here

Or you can try to lower your design library version to 27. (And the compile sdk version also to 27)

dependencies { implementation 'com.android.support:appcompat-v7:27.0.2' implementation 'com.android.support:design:27.0.2' }
Nishan
  • 3,644
  • 1
  • 32
  • 41
1

Try adding "Base" before Theme in styles.xml as show : - "Base.Theme.AppCompat.Light.DarkActionBar"

1

Permanent solution for this problem: change your build gradle (module app) to implementation com.android.support:appcompat-v7:28.0.0-alpha1.

anothernode
  • 5,100
  • 13
  • 43
  • 62
0

change your build gradle (module app) from : com.android.support:appcompat-v7:28.1.1-alpha3

to : com.android.support:appcompat-v7:27.1.1

  • Can you explain why downgrading a dependency would fix the problem? – Robert Sep 27 '18 at 13:53
  • @Bajirang The dependencies version should match the compileSdkVersion. So downgrading to 27 would also require the OP to downgrade the compileSdkVersion. Instead, try [this](https://stackoverflow.com/a/49305312/7551190) which helped me solve such similar problem – Kathir Nov 27 '18 at 06:53
0

1.try this first : make changes in Gradle (module app) for appcompat:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

2. If it doesn't work clean your project and then again build it. In my case, it worked.