exception raised during rendering:Binary XML file line #-1:error inflating class<unknown>

匿名 (未验证) 提交于 2019-12-03 07:50:05

问题:

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.

xml file:

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.(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.(CompoundButton.java:89) at android.widget.CheckBox.(CheckBox.java:70) at android.widget.CheckBox.(CheckBox.java:66) at android.widget.CheckBox.(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) 

回答1:

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



回答2:

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.



回答3:

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.



回答4:

I have selected the previous version as suggested but still did not see the previous image.

What I did was this:

  1. In the list of versions selected the " previous version " and "Preview Androids Versions " .

  2. 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 .



回答5:

I had a similar problem. I resolved it by decreasing the size of the images in the drawable folder.



回答6:

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.



回答7:

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.



回答8:

You can try to change the AppTheme.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!