I'm trying out the new Android Studio 2.2 Preview, and for some reason the layout editor isn't working for layouts that were created in the old version. It keeps telling me various resources aren't found... (Such at the file that I just opened.)
Am I missing something? Is there soemthing I'm unaware of that I should have done when opening an old project?
It seems to be fine when I create a new layout. It's only the previously created layouts and menus that seem to have an issue.
Anyone else experiencing this?
I've tried cleaning, and rebuilding the project.
EDIT
Ok interesting- the problem seems to only happen for layouts that include other layouts. If I remove the include statement it renders fine, but if I add it back, it can't find the included item and gives me an issue. (Even though I can apparently open the included layout itself, and it renders just fine...)
UPDATE
Apparently it only seems to happen with the merge tag. If the layout being included uses the merge tag it won't render and I get the below error. If I remove the merge, and just use another layout tag it seems to work fine.
android.content.res.Resources$NotFoundException: Could not find layout resource matching value 0x7FFF03A2 (resolved name: item_monster_edit) in current configuration.
at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:913)
at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:900)
at android.content.res.Resources_Delegate.getLayout(Resources_Delegate.java:437)
at android.content.res.Resources.getLayout(Resources.java:1111)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:136)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:902)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:854)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:317)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:534)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:534)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$41(RenderTask.java:660)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:380)
at com.android.tools.idea.rendering.RenderTask.inflate(RenderTask.java:660)
at com.android.tools.idea.uibuilder.model.NlModel.inflate(NlModel.java:321)
at com.android.tools.idea.uibuilder.model.NlModel.render(NlModel.java:378)
at com.android.tools.idea.uibuilder.surface.DesignSurface$3.modelChanged(DesignSurface.java:794)
at com.android.tools.idea.uibuilder.model.NlModel.lambda$notifyListenersModelUpdateComplete$52(NlModel.java:454)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.android.tools.idea.uibuilder.model.NlModel.notifyListenersModelUpdateComplete(NlModel.java:454)
at com.android.tools.idea.uibuilder.model.NlModel.updateModel(NlModel.java:368)
at com.android.tools.idea.uibuilder.model.NlModel$1.run(NlModel.java:231)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:267)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:282)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:378)
at com.intellij.util.Alarm$Request.run(Alarm.java:389)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:227)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:187)
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)
You probably solved this already but I had the same problem with the same error. Always with included layouts.
The solution was to invalidate cache /restart in Android studio. Now it is working and the preview shows the layout with the included layout.
Press Ctrl+Shift+A (Cmd+Shift+A on Mac?)
Write "invalidate"
Select "Invalidate Caches / Restart"
Seems many developers been experiencing this issue. You can star it here 211183
If you cant wait for Tools guys to fix it, switch to older Studio versions. 2.1 should work fine.
Edit: Fixed in Preview 5
Just remove these lines and may b it will get fixed
android:background="?android:attr/windowTitleStyle">
This happens wen u the attributes arent set properly.
Related
i found solution ,and i replace new 2.3.3 as ,and use 1.0.2
all of the question render problem solved!!!
Cause the problem that IDE AS 1.0.2 use actionbar !
But as2 etc looks like OLD ACTIONBAR DEPRECIATED!
I am making an Android app and trying to use an ActionBar.
I am getting the following error in the log:
UnsupportedMethodException
Unsupported method: AndroidProject.getPluginGeneration().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
And this error for the layout:
Rendering Problems Unable to find the layout for Action Bar.
Consider updating to a more recent version of appcompat, or switch the
rendering library in the IDE down to API 21 (Details) Tip: Try to
refresh the layout.
When I tried reducing the SDK version to 20 or 21 it did not help.
Has anyone been able to solve this?
The details about action bar? I guess it is ,but I am not sure?
Rendering Problems (Details)
java.lang.RuntimeException: Unable to find the layout for Action Bar.
at com.android.layoutlib.bridge.bars.BridgeActionBar.<init>(BridgeActionBar.java:57)
at com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:59)
at com.android.layoutlib.bridge.impl.Layout.createActionBar(Layout.java:238)
at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:150)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:301)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$70(RenderTask.java:659)
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)
I am having this issue with Rendering problems every time i open a project.
java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36)
at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:192)
at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:186)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$72(RenderTask.java:659)
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)
Screenshot of the problem
I don't know how to fix it permanently, or why this is happening repeatedly.
I read up on it and someone suggested that I Change the theme to the following:
theme change
I did that, and it takes care of the problem for the session, but as soon as i close android studio ad open it back up again, i am greeted by the sae problem.
What am I doing wrong here?
How can I fix this for good?
Restart Android Studio by invalidating the caches
File → Invalidate Caches / Restart.
This may fix the issue.
For more information visit this site
Alternative Solution
Use a higher SDK as the minimum SDK like lollipop or marshmallow when building the project. If you really want to use a lower SDK as the minimum SDK, start from blank activity and develop from there onwards
on the very first line of your log cat its already telling you
java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
follow as it says.
I tried to include check boxes in the layout and after dragging and dropping I get this error:
exception raised during rendering:Binary XML file line #-1:error
inflating class<unknown>.
xml file:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.nidhigupta.shopping2.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:id="#+id/textView" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="#+id/checkBox"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
please provide step by step solution.
details link says :
java.lang.NoSuchMethodError: android.graphics.drawable.VectorDrawable_Delegate.nCreateTreeFromCopy(JJ)J
at android.graphics.drawable.VectorDrawable.nCreateTreeFromCopy(VectorDrawable.java)
at android.graphics.drawable.VectorDrawable.access$400(VectorDrawable.java:204)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.createNativeTreeFromCopy(VectorDrawable.java:837)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.<init>(VectorDrawable.java:812)
at android.graphics.drawable.VectorDrawable.mutate(VectorDrawable.java:268)
at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:817)
at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:329)
at android.graphics.drawable.AnimatedStateListDrawable$AnimatedStateListState.addStateSet(AnimatedStateListDrawable.java:602)
at android.graphics.drawable.AnimatedStateListDrawable.parseItem(AnimatedStateListDrawable.java:525)
at android.graphics.drawable.AnimatedStateListDrawable.inflateChildElements(AnimatedStateListDrawable.java:453)
at android.graphics.drawable.AnimatedStateListDrawable.inflate(AnimatedStateListDrawable.java:385)
at android.graphics.drawable.DrawableInflater.inflateFromXml(DrawableInflater.java:130)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1224)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1197)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:315)
at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:681)
at android.widget.CompoundButton.<init>(CompoundButton.java:89)
at android.widget.CheckBox.<init>(CheckBox.java:70)
at android.widget.CheckBox.<init>(CheckBox.java:66)
at android.widget.CheckBox.<init>(CheckBox.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:107)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:149)
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.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:317)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7.run(AndroidDesignerEditorPanel.java:519)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
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)
UPDATE Sep/2016
Issue is no longer reproducible on Android Studio v2.2. Update your Android Studio and the issue will be no longer reproducible.
UPDATE Aug/2016
Issue is still happening in Android Studio v2.1.3
Original Answer
It seems this is an issue and it is being handled by google HERE:
Some other people are facing the same issue and the fix is always to change the preview API from 24 to 23 (or any other version).
You may need to download a previous version of SDK.. You don't need to change your build.gradle... Just download the SDK and Android Studio will allow you to change the SDK in Layout Preview
Rendering Problem Related Issue is Resolved Check out the Answer here that says
android studio pick Automatically Pick Best by default
so you have to select previous one API 23 manually.
I have similar issue and resolve it by manage pixel sizes of drawables and width-height of controls in xml file. Please do not add any controls in xml file which is not used in class file.
I had a similar problem. I resolved it by decreasing the size of the images in the drawable folder.
You can try to change the AppTheme.
I have selected the previous version as suggested but still did not see the previous image.
What I did was this:
In the list of versions selected the " previous version " and "Preview Androids Versions " .
Once the screens appear earlier versions of android I click on one of the previous and drag on the image layout that does not images.
To me it worked well , I hope and serve them . We're reading .
I was using API 22, though API 25 was available on my System.
Moving the problematic tab between different split views did the trick in a second.
I've had this exception before and what worked for me was File -> Invalidate Caches/Restart.
You may try that, but you should know that all of the Local History will be deleted.
Edit: Downgrading from API 24 to API 23 also works.
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?
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".
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 .
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.
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.
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).
Android Studio straight crapped out on me tonight. I went to open my project and now I can't use the activity UI. Two different errors:
activity_main.xml
The following classes could not be found:
- android.support.v7.internal.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Create Class)
Tip: Try to build the project.
settings_activity.xml
java.lang.NullPointerException
at com.android.layoutlib.bridge.impl.RenderSessionImpl.isThemeAppCompat(RenderSessionImpl.java:1203)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.findStatusBar(RenderSessionImpl.java:1066)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.init(RenderSessionImpl.java:209)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:319)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:497)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:485)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:485)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:590)
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)
The second error I have no clue about, but the first one is really weird to me. I've already imported com.android.support:appcompat-v7:22.1.0 in the Dependencies, and the application deploys fine in both debug and release environments.
Thoughts?
Edit: Per suggestion, I can render my main activity using API 21. However, my settings activity still won't render the new error is:
Missing styles.
Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
Failed to find style 'textViewStyle' in current theme (2 similar errors not shown)
Edit 2: I managed to fix the second issue by just selecting a different theme from the list and then selecting back onto my AppTheme. Not sure why I needed to do that, but whatever. Aside from my Switch element being completely black, it renders just fine now.
First of all build project, then change "android version to use when rending layouts" to lower (design screen-> top panel->icon with android).
also it can't rending custom view