XML 渲染错误 Android 预览 N

我已经更新 android SDK 到 android 预览 N 后更新,我得到这个 xml 呈现错误。点击详细信息后,它会显示如下堆栈跟踪如何避免这种情况

?

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 org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:649)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:80)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:594)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:589)
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)
31551 次浏览

This is bug in Android Studio. Usually you get error: Unsupported major.minor version 52.0

WORKAROUND: If you have installed Android N, change Android rendering version with older one and the problem will disappear.

SOLUTION: Install Android SDK Tools 25.1.3 (tools) or higher

enter image description here

NEW SOLUTION:

After Updating Android SDK Tools 25.1.3 It will remove automatically that bug.

Update your SDK Tools.

enter image description here

OLD SOLUTION:

I got same problem after updating sdk with

enter image description here

I think there is some bug in API level N, I really appreciate the answer of Ivo Stoyanov but I found another solution that is:

First of all I have change Android Version to use when Rendering layout in IDE with API 23: Android 6.0

enter image description here

Now Error is gone away. I don't know exactly why but Now Its doesn't seems to me.

Thank you :)

It cause while rendering version is Andorid API 23: AndroidN(Preview). Need to change it . It is a Issue 203683: Unsupported major.minor version 52.0

I had similar kind of error. I followed the steps mentioned above. I changed the preview version to older version and it worked.

Screenshot for the same