I'm using the latest version of android studio (3.0), along with latest build tools (27) and similar API level.

The layout does not get rendered in the design tab and it's causing a lot of trouble especially that I'm using coordinator layout.

How do I get around this problem?

  • 2
    have you tried invalidate caches/restart ? – Abdul Kawee Mar 15 at 6:01
  • please add some code or more explain – erfan Mar 15 at 6:03

15 Answers 15

up vote 85 down vote accepted

I solved this rendering problem by simply inserting this line into the application theme.

[SDK 28]

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

[SDK 27]

<style name="AppTheme">
  <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>
  • 6
    Wasted hours on this. Do you know why it happens ? I had no problem before but suddenly – Mahdi Rafatjah Apr 11 at 16:26
  • 6
    Thanks. It's ridiculous that Android Studio requires this. – Monte Creasor May 8 at 23:02
  • 7
    Good for you, it happen for me on starting up the Hello World app :D mean they introduce a built-in error :)) – deadManN May 20 at 5:54
  • 10
    not working for me with Android Studio 3.1.2 – brijesh kumar Jun 21 at 10:43
  • 7
    If it is saying it doesn't exist, trying just typing beginning to type "Coord" and it should give you some options. Mine was under @style/Widget.Support.CoordinatorLayout – Chris Jul 27 at 3:10

Turns out the new SDK 28 is unfortunately introducing this error on Android Studio when you create a new project.

How to solve:

Check your build.gradle (Module: app) file and change:

compileSdkVersion 28
targetSdkVersion 28

To:

compileSdkVersion 27
targetSdkVersion 27

Also, make sure you are using the right dependencies version:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
  • 4
    Alternatively stay on SDK 28 and instead downgrade the support library versions from 28.0.0-alpha3 to 28.0.0-alpha1, as suggested in this answer stackoverflow.com/a/51091869/1488656 – Livven Jul 15 at 22:56
  • That's it, changing the SDK 28 to 27 and sync Gradle solved the problem. – Thiago Souza Aug 31 at 1:05

implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' in build.gradle(module) change alpha 3 to alpha 1. sync and you should be good to go. I spent almost a day trying to figure this out. none of these answers worked for me. hope this helps

  • 2
    i had to change implementation 'com.android.support:design:28.0.0-alpha3' also into alpha1 – Mujeebcpy Jul 7 at 18:16

I was also facing the same problem. Nothing like changing theme from Layout preview window helped me.

Solution: I updated my build.gradle(app) with:

dependencies {
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
}

One more thing:

compileSdkVersion 27
targetSdkVersion 27
  • 2
    Alternatively stay on SDK 28 and instead downgrade the support library versions from 28.0.0-alpha3 to 28.0.0-alpha1, as suggested in this answer stackoverflow.com/a/51091869/1488656 – Livven Jul 15 at 22:58
  • I have tried..but unfortunately didn't help :( – Anu Chaudhary Jul 16 at 5:48
  • This one did it for me – Jonas Grønbek Jul 19 at 12:00
  • & volaah.......!!!!! – Uzair Qaiser Aug 30 at 10:26

For Android Studio 3.1.4 users: I've tried marked answer but it didn't work for me. Inserting this line:

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

into the application theme doesn't solve the rendering problem so I've undone that change.

Solution: I've made this changes in my build.gradle(Module:app) file:

Before change:

android {
   compileSdkVersion 28
      defaultConfig {
         targetSdkVersion 28
      }
   }
}

dependencies {
   implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
   implementation 'com.android.support:design:28.0.0-rc01'
}

After change:

android {
   compileSdkVersion 27
      defaultConfig {
         targetSdkVersion 27
      }
   }
}

dependencies {
   implementation 'com.android.support:appcompat-v7:27.1.1'
   implementation 'com.android.support:design:27.1.1'
}

It worked for me perfectly. Hope that will be useful.

  • Is it possible that Google is releasing RC an we still need to use 27? – tiagocarvalho92 Aug 30 at 15:55

Thanks for the response, I found the solution tinkering with the code,

I had tools:showIn attribute enabled in the parent layout of a fragment, which I moved to a viewpager, it was previously embedded in a host activity, lint did not catch it though, which is a bit surprising.

 <style name="Theme.Shrine" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
</style>

Add in your material theme.

  • 3
    does not recognize in my 28 alpha support library. – Abhinav Saxena Jun 23 at 14:07
  • I had to do this to get mine working. Found it by using Android Studio intellisense and just beginning to type "Coord" – Chris Jul 27 at 3:08

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 enter image description here

As an aside, in design view of Android Studio, if I add the following to the styles.xml file:

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

and add the following to the CoordinatorLayout in the layout's xml resource file

<android.support.design.widget.CoordinatorLayout
    android:theme="@style/Coordinator"
    android:orientation="vertical"
    android:id="@+id/sample_layout_id"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/sample_background"
    tools:theme="@style/Coordinator">

then, at least, the design view stops generating the missing coordinatorLayoutStyle error.

  • Hello Please try to mention things like why it was not working. and changes you suggested why does that make difference. – Mihir Dave Jun 27 at 18:09
  • It was not working because of an Android Studio bug. – Phillip Jun 28 at 14:35

My Android studio version 3.1.3.
i'm worked with uninstall ALL SDK version 28.
Step is Open SDK Manager > SDK Platforms > Show package Details > Untick SDK 28 > apply and Create new project.

I have the same problem but on the Android studio 3.1.4

So, at first I have done the following in build.gradle

Replace this:

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

implementation 'com.android.support:design:28.0.0-rc01'

implementation 'com.android.support:support-v4:28.0.0-rc01'

with that:

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

implementation 'com.android.support:design:28.0.0-alpha1'

implementation 'com.android.support:support-v4:28.0.0-alpha1'

But somehow after project rebuild the problem repeats again.

So, I have go this way:

Here is my project gradle.build

buildscript {
    ext.kotlin_version = '1.2.41'
    ext.android_support = '27.1.1'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And here app build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "*****.******"//Replace with your own ID
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'

    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    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'
}

And this solve my problem

Thank you

I will post an answer The other answers may work but no one should need to download Preview Version and doing Material Design with no Action Bar is not the way to START developing apps with Android Studio
Our version of Android Studio is 3.1.4 Our default API is 28 Our FIX is to downgrade to API 26 YOU do this by clicking File -> Project Structure then highlight app Under the Properties TAB Change Compile Sdk version to API 26 Now click on the Falavors TAB and change Target Sdk version to 26
Then in build.gradle(module:app) add these changes

implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'

I guess one could always justify this slow FIX by Google to learn to use the ToolBar

This maybe existing issue: https://issuetracker.google.com/issues/37048767

Render using other versions of Android (say Android API 22).

Or check for any typos or invalid XML entries.

Refer here: Missing styles. Is the correct theme chosen for this layout?

<!-- 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>
    <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

just add coodrinatorLayoutStyle as an item in style.xml and it worked for me.

Just Change implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' and 'com.android.support:design:28.0.0-alpha3' to alpha 1. That's how i solved the problem.

protected by Community Sep 13 at 6:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.