org.xmlpull.v1.XmlPullParserException为"无效绘制标签位图" [英] org.xmlpull.v1.XmlPullParserException for "invalid drawable tag bitmap"

查看:169
本文介绍了org.xmlpull.v1.XmlPullParserException为"无效绘制标签位图"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这很奇怪。

我收到这个错误我的活动之一时,奇怪的是,位图采用的是每一次活动!我甚至不知道如何重现例外,它的正常工作,我(和其他人,我认为)。

I've received this error for one of my activities, the weird thing is that the bitmap is used in every Activity! I don't even know how to reproduce the exception, it's working fine for me (and others I think).

这是整个堆栈跟踪:

java.lang.RuntimeException: Unable to start activity ComponentInfo{it.enrichman.bolloauto/it.enrichman.bolloauto.activities.ArchivioActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class android.widget.ListView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1872)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4385)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class android.widget.ListView
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:250)
at android.app.Activity.setContentView(Activity.java:1742)
at it.enrichman.bolloauto.activities.ArchivioActivity.onCreate(ArchivioActivity.java:36)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1836)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
... 22 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/backrepeat.xml from color state list resource ID #0x7f020075
at android.content.res.Resources.loadColorStateList(Resources.java:1855)
at android.content.res.TypedArray.getColor(TypedArray.java:319)
at android.widget.AbsListView.<init>(AbsListView.java:632)
at android.widget.ListView.<init>(ListView.java:164)
at android.widget.ListView.<init>(ListView.java:160)
... 25 more
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag bitmap
at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:146)
at android.content.res.ColorStateList.createFromXml(ColorStateList.java:129)
at android.content.res.Resources.loadColorStateList(Resources.java:1852)
... 29 more

丢失的资源是这个(绘制文件夹中):

The "missing" resource is this one (inside drawable folder):

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/bg"
        android:tileMode="repeat" />

在BG绘制里面绘制,华电国际(可能是一个问题吗?),但正如我所说它在每一个活动为背景的used!

The "bg" drawable is inside drawable-hdpi (could be that a problem?), but as I said it's used in every activity as background!

的误差的布局的设置期间调用

The error is called during the setting of the layout:

setContentView(R.layout.archivio);

在XML的布局是这个:

The xml layout is this one:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="BLABLABLA"
            android:id="@+id/archivioTextView" android:layout_gravity="center_horizontal"
            android:gravity="center_horizontal" android:textIsSelectable="false" android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp" android:layout_marginRight="30dp" android:layout_marginLeft="30dp"/>
    <ListView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/listaVeicoli" android:layout_gravity="center" android:drawSelectorOnTop="false"/>
</LinearLayout>

(提出了一些无用的声明由的IntelliJ的设计师!)

(Some of the useless statements are put by the Designer of IntelliJ!)

我已经找了类似的问题,但我没有奇怪的ID如@ + ID /列表或其他问题,其他用户encuntered ..

I've looked for similar problems but I don't have "strange" id like @+id/list or other problems that other users encuntered..

对此有何帮助?我在想什么? 谢谢

Any help on this? What am I missing? Thanks

推荐答案

在最后,我终于找到了解决办法。 我试着用不同的模拟器,我是有这个崩溃只有10 API(2.3.3)或更小。环顾XML,并尝试做不同的东西(也复制BG绘制无处不在,或者改变ID进入我的列表),我发现这个奇怪的东西在我的自定义主题:

In the end I've found FINALLY the solution. I've tried with different emulator and I was having this crash only with API 10 (2.3.3) or less. Looking around the xmls and trying to do different stuff (also copying the bg drawable everywhere, or changing id to my list) I've found this weird stuff in my custom theme:

<item name="android:windowBackground">@drawable/backrepeat</item>
<item name="android:colorBackground">@drawable/backrepeat</item>

这似乎是较新的Andr​​oid版本,但对老年人1是没有问题的。

This seems to be not a problem for newer android version but for older one yes.

只需卸下colorBackground定义(也许应该只有一种颜色),这就是它!

Just remove the colorBackground definition (that maybe should be only a color) and that's it!

我希望这会帮助别人!

这篇关于org.xmlpull.v1.XmlPullParserException为&QUOT;无效绘制标签位图&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆