Rendering Problems Exception raised during rendering: com.android.ide.common.rendering.api.LayoutlibCallback

AndroidAndroid Studio

Android Problem Overview


I encountered a problem when creating a project in Android Studio. (Version 1.5.1)

I describe my actions step-by-step:

  • Open Android Studio.
  • Create a new project without any activity.
  • Make a blank activity.

And there might be a problem in preview mode:

I get this message:

Rendering Problems Exception raised during rendering: com.android.ide.common.rendering.api.LayoutlibCallback.getXmlFileParser(Ljava/lang/String;)Lorg/xmlpull/v1/XmlPullParser;

In stack trace:

java.lang.NoSuchMethodError: com.android.ide.common.rendering.api.LayoutlibCallback.getXmlFileParser(Ljava/lang/String;)Lorg/xmlpull/v1/XmlPullParser;
	at com.android.layoutlib.bridge.impl.ResourceHelper.getInternalComplexColor(ResourceHelper.java:146)
	at com.android.layoutlib.bridge.impl.ResourceHelper.getColorStateList(ResourceHelper.java:231)
	at android.content.res.BridgeTypedArray.getColorStateList(BridgeTypedArray.java:308)
	at android.widget.TextView.<init>(TextView.java:776)
	at android.widget.TextView.<init>(TextView.java:705)
	at android.widget.TextView.<init>(TextView.java:701)
	at com.android.layoutlib.bridge.MockView.<init>(MockView.java:50)
	at com.android.layoutlib.bridge.MockView.<init>(MockView.java:45)
	at com.android.layoutlib.bridge.MockView.<init>(MockView.java:41)
	at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:163)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
	at com.android.layoutlib.bridge.bars.CustomBar.<init>(CustomBar.java:95)
	at com.android.layoutlib.bridge.bars.StatusBar.<init>(StatusBar.java:67)
	at com.android.layoutlib.bridge.impl.Layout.createStatusBar(Layout.java:222)
	at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:144)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:213)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:426)
	at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
	at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:510)
	at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:498)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:888)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:498)
	at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:72)
	at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:610)
	at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:607)
	at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:362)
	at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:607)
	at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:629)
	at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
	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:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

What could be the problem?

Android Solutions


Solution 1 - Android

I had the same problem after some updates minutes ago, what I did to solve the rendering issue was to change the android version used to render layouts from Android Studio back to "API 23: Android 6.0".

Android studio

Solution 2 - Android

> java.lang.NoSuchMethodError: > com.android.ide.common.rendering.api.LayoutlibCallback.getXmlFileParser(Ljava/lang/String;)Lorg/xmlpull/v1/XmlPullParser;

Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method.Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

Your app must target Android 6.0 (API level 23) to enable this behavior; you do not need to add any additional code.

Just select "API 23: Android 6.0" in Preview Section . enter image description here

Solution 3 - Android

I had the same issue when I installed android studio 2.1 on ubuntu 14.04.Even the android robot icon which displays the android version used for rendering layout was only showing API Level 24 version and no other versions.

I had to enable API 23 to be downloaded by navigating to the below path

Tools -> SDK Manager -> Android SDK -> SDK Platforms -> Name.

Check the Android 6.0(Marshwallow) option.This will be downloaded now. Now you will be able to see API Level 23 and by selecting which we can get around this issue.

Solution 4 - Android

I had a similar problem with Android Studio 1.5.1 in Windows 10. The preview was not working no matter what version of Android was selected. The stacktrace starts with:

> "java.lang.NoSuchMethodError: > com.android.ide.common.rendering.api.LayoutlibCallback.getXmlFileParser(Ljava/lang/String;)Lorg/xmlpull/v1/XmlPullParser;"

When I remove the attribute tools:showIn="@layout/activity_main" from the RelativeLayout the problem resolves for all Android versions except "N". I have Android 2.2, 2.3.3, 5.0.1 and 6.0 enabled

I can't explain why the action resolves the problem though or why it does work for version N.

Solution 5 - Android

This is no timely answer but for anyone looking for anyone else experiencing the same problem an update of the android studio does the trick. While all the suggestions above work you want get update(version 2.1.2).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShtihlFDView Question on Stackoverflow
Solution 1 - AndroidElvisView Answer on Stackoverflow
Solution 2 - AndroidIntelliJ AmiyaView Answer on Stackoverflow
Solution 3 - AndroidcrackerplaceView Answer on Stackoverflow
Solution 4 - AndroidgithekoView Answer on Stackoverflow
Solution 5 - AndroidStephen NyamweyaView Answer on Stackoverflow