Tom Finet
Tom Finet

Reputation: 487

Android Studio not rendering layout

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.

Upvotes: 13

Views: 21162

Answers (7)

Boris Van Leuven
Boris Van Leuven

Reputation: 21

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'

}

Upvotes: 0

patidar patidar
patidar patidar

Reputation: 21

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

Upvotes: 2

Lazy Ninja
Lazy Ninja

Reputation: 22527

You need to choose the correct API version.

enter image description here

Upvotes: 13

dagelf
dagelf

Reputation: 1729

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.

Upvotes: 27

Santhosh Kumar S
Santhosh Kumar S

Reputation: 136

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

Upvotes: 3

shadox
shadox

Reputation: 3709

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.

Upvotes: 0

Arnold Laishram
Arnold Laishram

Reputation: 1881

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

Upvotes: 2

Related Questions