13

I have started a new android studio project and on opening of the main activity, the design view shows this error and does not show the layout on the emulator:

org.jetbrains.android.uipreview.RenderingException: Failed to load the LayoutLib: com/android/layoutlib/bridge/Bridge : Unsupported major.minor version 52.0 at org.jetbrains.android.uipreview.LayoutLibraryLoader.load(LayoutLibraryLoader.java:90) at org.jetbrains.android.sdk.AndroidTargetData.getLayoutLibrary(AndroidTargetData.java:180) at com.android.tools.idea.rendering.RenderService.createTask(RenderService.java:166) at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:475) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310) at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227) at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) at com.intellij.util.Alarm$Request$1.run(Alarm.java:351) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695)

What is the problem here? Thanks.

Tom Finet
  • 487
  • 1
  • 7
  • 21
  • Possible duplicate of [Android Studio rendering problems](http://stackoverflow.com/questions/18195807/android-studio-rendering-problems) – Viral Patel Mar 28 '16 at 19:33
  • Problem solved, thanks. – Tom Finet Mar 28 '16 at 19:46
  • @TomFinet if an answer solved your solution it's a good idea to "accept it" so other people would know which specific answer did it for you. also the person gets 15 additional reputation points – xmoex Apr 22 '16 at 20:15

7 Answers7

27

Do you see the little Android icon?

Not the one in the top toolbar, the one in the toolbar just below it. Click the little drop down triangle next to it and choose the correct API version!

That was all I needed to do. The rendering took a while to load but it actually worked and the error message disappeared.

dagelf
  • 1,468
  • 1
  • 14
  • 25
13

You need to choose the correct API version.

enter image description here

Lazy Ninja
  • 22,342
  • 9
  • 83
  • 103
3

Change your App theme in the theme options for DeviceDefault or DeviceDefault.Light. This may works.

Santhosh Kumar S
  • 136
  • 2
  • 11
2

Though I am not sure this might work. I found few links where people have faced same issue.

you have to choose a correct api level from the drop down. this is the link

Community
  • 1
  • 1
Arnold Laishram
  • 1,801
  • 2
  • 18
  • 25
2

Usually you get error: Unsupported major.minor version 52.0

If you have installed Android N, change Android rendering version with older one and the problem will disappear.enter image description here

Image

Nikhil
  • 3,711
  • 8
  • 32
  • 43
0

Check that Java SDK version is the right one for Android Studio. Check that preview for layout is supported and you have sdk for that particular version of API you want to view. Check that's not Android N on the preview, if it is, you probably don't have all SDKs you need. Try installing them. Be sure to put in your question other details, as OS you are using, Java SDK you have installed, Android API SDKs you have.

shadox
  • 3,238
  • 4
  • 24
  • 38
  • And where might you find out which versions are the correct ones? One would hope the defaults would be correct in the first place... – dagelf Apr 03 '16 at 17:59
  • The only default that's default for real is Java SDK within your computer if it's Mac or Windows and you didn't change that. On Mac I use 3 Java SDKs, 6,7 and 8 Check for yours in Project Structure>SDK. I set 7 for Android Studio and 8 for my other Java projects. Android SDKs (not Java SDK) needed are those that you target in first place. If you target API 21 you should install that one via SDK manager in Android studio. If you need also API 19, you should add that as well. The default depends on your project. – shadox Apr 04 '16 at 10:15
0

These are my dependencies and it works fine for me

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'android.arch.core:runtime:1.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
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'
compile 'com.google.firebase:firebase-core:16.0.0'
apply plugin: 'com.google.gms.google-services'

}