Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 977
Tom Finet Avatar asked Mar 28 '16 19:03

Tom Finet


People also ask

Why design is not showing in Android Studio?

It depends on your version. Here is a better way: open project and right click on app then go to open module settings click on dependencies tab and then click + icon on right then click 1st option which is library dipendency choose your dependencies click ok.

What is mock view in Android Studio?

A view that is useful for prototyping Views that will move in MotionLayout. A view that is useful for prototyping layouts. Added in 2.0. Basic view that can draw a label (by default the view id), along with diagonals. Useful as a temporary mock view while building up a UI.

Which layout is best in Android Studio?

Use FrameLayout, RelativeLayout or a custom layout instead. Those layouts will adapt to different screen sizes, whereas AbsoluteLayout will not. Definitely right. I recommend RelativeLayout since it keeps the view hierachy flat.

Where is Activity_main XML located?

activity_main. xml: This file located in the res/layout folder. It defines what components to display and how to display them in referenced activity view. Double click this file, you can see the content in the right panel, it has a Design view and a Text view, you can click the bottom Design and Text tab to switch.


5 Answers

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.

like image 79
dagelf Avatar answered Oct 02 '22 23:10

dagelf


You need to choose the correct API version.

enter image description here

like image 20
Lazy Ninja Avatar answered Oct 03 '22 00:10

Lazy Ninja


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

like image 39
Santhosh Kumar S Avatar answered Oct 02 '22 22:10

Santhosh Kumar S


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

like image 30
Arnold Laishram Avatar answered Oct 02 '22 22:10

Arnold Laishram


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

like image 34
patidar patidar Avatar answered Oct 03 '22 00:10

patidar patidar