Home » Android » android – Rendering Problems Failed to load the LayoutLib:

android – Rendering Problems Failed to load the LayoutLib:

Posted by: admin June 15, 2020 Leave a comment

Questions:

Rendering Problems Failed to load the LayoutLib: com.android.layoutlib.bridge.Bridge (Details)

org.jetbrains.android.uipreview.RenderingException: Failed to load the LayoutLib: com.android.layoutlib.bridge.Bridge
    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:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

screen

How to&Answers:

According to Layout preview rendering problems in android studio(Android Studio 1.2)

Try changing your base application theme using below code – in res/values/styles.xml

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

OR

Also you can try Switching the preview’s API level to lower one from
the preview configuration

enter image description here

I think also updating your Android Studio to 2.0 Beta 2 by Canary channel might solve a problem.

If still doesn’t work try to run your app on device – is layout here displaying properly?

You may also read this: Android Studio rendering problems

EDIT: Check also solutions in these posts:

In this post Failed to load the LayoutLib: com.android.layoutlib.bridge.Bridge you would find:

Possibly Classes With Identical names inside different projects.

I might know the issue. I just recreated a framework I made, and I
called it number 2. A lot of the classes had the same name, and same
method, inside packages of the same name. This seemed to really
confuse the IDE and/or JRE.

I was able to sort of fix the problem, by making sure they weren’t
both being imported inside the same project! It is still giving me
strange warnings, but it seems to be working correctly. What I would
ultimately suggest if this is the case, would be to remove the
duplicates from the project all together.

Answer:

I am using Android Studio 1.5, and to solve this issue I change the API version from the default API 23: Android N (preview) to the API 23 Android 6.0 as shown in the image below.

You might need to restart Android studio or not depending on your configurations.

Hope it helps!!

enter image description here