I'm using android studio 1.4

It has passed some time since the last time I've created a new project in android studio and today when I did it the android studio does not show anything from the layout preview. Its a blank window and says "nothing to show".

I think it's related with the new support design library cuz I've never seen this new "default code". I've researched a bit and it's the new android material design guidelines ...

I've already

  1. updated the sdks tools
  2. cleaned the project and rebuild it
  3. invalidated and restarted caches

and still nothing.

Thanks in advance.

Updated: I decided to update 1.5.1 it's like this: it's giving me that rendering problem.. I think it's not showing correctly the lower right button, cuz I think it's supposed to be a button with a message icon in it and in my AS just shows the message icon (correct me if I'm wrong).

enter image description here

enter image description here

  • add screenshot link to this problem, it may have many reasons ;-) – piotrek1543 Dec 28 '15 at 20:01
  • @piotrek1543 updated – Cap.Alvez Dec 28 '15 at 20:07
  • 1
    wow, I haven't expected that. Ok, update your Android Studio to latest version – piotrek1543 Dec 28 '15 at 20:09
  • 3
    @Cap.Alvez Can you try to change the App theme to for example Holo.Light.NoActionBar – kar Dec 28 '15 at 20:47
  • 1
    @Cap.Alvez That usually works for me. One other thing I can think of is did you start a 'Blank' Activity or 'Empty' Activity? If you did Blank, can you try to make a new project for testing using Empty and set Theme to Holo.Light as mentioned earlier. – kar Dec 28 '15 at 21:45

18 Answers 18

Choose another theme (other than Holo, for example Theme)

Solution Image

When you create the style incorrectly or from an existing style, this problem usually occurs. So select the "Graphical Layout" select "AppTheme" (The tab with a blue star). And select any of the predefined style. In my case "Light" which should resolve the problem.

Try to 'Invalidate caches & restart'.

how to invalidate cache & restart

Restart your Android Studio by choosing this option. It may take some time, be patient.

Then, if still doesn't work try to rebuild your project.

  • 5
    Invalidate caches / restart worked for me – Pierre Jauniaux Dec 28 '16 at 21:29
  • Invalidate caches worked for me when I had an empty Preview tab with no device config buttons. – Aleksander Niedziolko Jun 12 at 13:26
  • As I didn't restart Android Studio for a couple of weeks. Was hibernating my laptop. Doing so worked for me. Thanks! – sud007 Jun 13 at 5:49
  • I was frustrated because there was no blue star. But then I found that the Theme icon on my tool bar is two concentric circles, with the inner one divided vertically in half with one side white and the other black. – ROBERT RICHARDSON Jun 22 at 22:26
  • What is I want to use App Theme ? – Agile_Eagle Jul 11 at 9:39

This is a common problem . It can be easily solved by changing res/values/styles.xml to

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

Steps :

  • Go to res/values/
  • open styles.xml

    • change from -> style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"

    • change to -> style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"

    (Just prepend "Base." to "Theme".)


  • Save the file and check Preview now.

  • Preview Works Perfeclty now.

  • 1
    your suggestion alone worked for me..thanks – Vignesh Jun 30 at 20:36
  • 1
    Solved my problem, thanks. – harshita Jul 14 at 6:06
  • 1
    This solved my issue also. Do you know the reason of this problem? – Johny Jul 14 at 19:59
  • 1
    Thanks man! That saved me countless hours of searching and debugging. – gameCoder95 Aug 5 at 15:54
  • 1
    it works perfectly fine for me – sangavi Aug 7 at 6:51

Check again for SDK update because API 23: Android N (preview) is now available, download it properly OR select the API 23: Android 6.0 from the top right of the preview window. check the image

enter image description here .
.
It (Android Studio) automatically selects the latest one even if it not properly installed. So,

What you need to do is :

  1. install the new one properly

    OR

  2. click on the previous one.

Force refresh helped me.

It is at the top of the design tab.

enter image description here

Find Styles.xml in Values.(res/Values/Styles.xml) Change this

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

to this:

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

Then clean and build project. Both of those you can do from build menu.

It worked for me.

  • It worked for me. It would be nice to have an additional explanation why it's happening. I suspect some of Android Studio's tutorials are not updated to reflect change in theme's class hierarchy. – Eugene Aug 19 at 10:47

I also go through same problem and do this simple work just go to res->values->style.xml and change <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> to <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

I faced the exact problem when creating a new project, It seams to be related to the Appcompat Library to solve it:

I replaced : implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' by implementation 'com.android.support:appcompat-v7:27.1.1' And everything worked fine.

In conclusion, The problem is related to a bug in the library version.

But if it is necessary to use the Natesh bhat's solution is for you.

  • There is an issue with the app compact as you said. Alternatively, if you are working with implementation 'com.android.support:appcompat-v7:27.1.1 you can change the last number sync gradle and then change it back. For me, this resolved the my issue. – George Mujuru Jul 22 at 11:51

Switch from Blank Activity and use Empty Activity. Change your theme to for example Holo.Light.NoActionBar.

Unlike Blank, Empty is more stripped down thus you may need to add some stuff yourself. Such as add the 2 Override methods onCreateOptionsMenu and onOptionsItemSelected yourself if you need to manipulate controls on the ActionBar and such. Otherwise, no other significant difference.

Fast Forward to 2018 and we are still having this issue!

When I had this issue with Android Studio Canary 3.2 today, this is what I did:

I went to

File -> Settings -> Plugins

On the plugins list, I disabled Android Support by unchecking it.

Then, I selected Apply and then, OK.

After this I restarted Android Studio.

On restart, I repeated the process:

File -> Settings -> Plugins

But this time, on the plugins list, I enabled Android Support by checking it.

Then I restarted.

When Android Studio came on, I allowed Gradle do its thing, then I did:

File -> Sync Project with Gradle Files

When this was done, I reopened my xml files or refreshed them anyhow possible and everything was fine.

Yeah long route, but on a day when I have to deliver at work? It sure works!

TLDR: Just disable and re-enable Android Support and you will be fine

It doesn't even show the "Hello World" in the preview when i started my first project,only displays 'Rendering problem' and 'Failed to instantiates one or more class'.This helps me out, try this..... in the left side menu, GoTo
base-> res-> values-> styles.xml
then write "Base." in the line <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
just before the Theme.AppCompat i.e <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Summary

In my case, Android Studio created project including support library which version is RC or beta. So I tried downgrade version of support library, then worked.
If your library version is RC or beta, try downgrade.

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

to this
implementation 'com.android.support:appcompat-v7:27.1.1'

and downgrade also compileSdkVersion, targetSdkVersion if you need.

Change the Android version to use while rendering layouts in the IDE.

Go to your xml layout file -> Design -> change Android API version from Automatically Pick Best to a value in between your minimum and target sdk versions.

Clean build your project by going to Build > Clean build.

It helped me when I had the same problem.

Here is a simple solution that worked for me:

  1. Go to File -> Settings -> Apperance & Behavior -> System Settings -> Android SDK :

  2. Check Show Package Details which is located on the bottom right.

  3. Under the latest Android SDK version (for ex: Android 8.1 (Oreo)), check Google Play Intel x86 Atom System Image
  4. Now click apply button

This system image helps android studio to show layout preview.

Changing the theme(near the android symbol for changing API version) from AppTheme to anything else like DeviceDefault or Holo fixed the problem easily.

just refresh your layout by clicking this:

there will be a blue logo at the top left of the "layout-design" page

click and choose "Force Refresh Layout"

enter image description here

Please (change com.android.support:appcompat-v7:28.0.0-alpha3) or (com.android.support:appcompat-v7:28.0.0-rc02) to (com.android.support:appcompat-v7:28.0.0-alpha1) in build.gradle (Module: App).

Next click File -> Invalidate Caches / Restart

Need internet access.

It works for me Windows 10 and in Ubuntu 18.04.1 LTS

Sometimes layout preview not show only in your current project, try open other project if in other project layout preview work well then the problem in your current project. in your current project try clean project, rebuild project, if still not working try make changes in your build.gradle app file, such add some implementation then gradle sync , check your layout preview works.

protected by Community Jul 22 at 12:58

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.