博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Widget.Material.Light.ProgressBar.Horizontal" (10302b8) is not a Drawable (color or path)错误解决
阅读量:2389 次
发布时间:2019-05-10

本文共 10011 字,大约阅读时间需要 33 分钟。

参考:

问题:

--------- beginning of crash05-23 18:36:40.164 3557-3557/com.lidan.xiao.danquestion E/AndroidRuntime: FATAL EXCEPTION: main    Process: com.lidan.xiao.danquestion, PID: 3557    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lidan.xiao.danquestion/com.lidan.xiao.danquestion.activity.QuestionActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392) at android.app.ActivityThread.access$800(ActivityThread.java:153) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5293) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:633) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365) at com.lidan.xiao.danquestion.activity.QuestionActivity.createView(QuestionActivity.java:176) at com.lidan.xiao.danquestion.activity.QuestionActivity.access$300(QuestionActivity.java:39) at com.lidan.xiao.danquestion.activity.QuestionActivity$2.getView(QuestionActivity.java:168) at android.widget.AdapterViewAnimator.showOnly(AdapterViewAnimator.java:548) at android.widget.AdapterViewAnimator.setAdapter(AdapterViewAnimator.java:971) at android.widget.AdapterViewFlipper.setAdapter(AdapterViewFlipper.java:144) at com.lidan.xiao.danquestion.activity.QuestionActivity.initView(QuestionActivity.java:172) at com.lidan.xiao.danquestion.activity.QuestionActivity.onCreate(QuestionActivity.java:72) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2280) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)  at android.app.ActivityThread.access$800(ActivityThread.java:153)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5293)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.view.LayoutInflater.createView(LayoutInflater.java:607) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.inflate(LayoutInflater.java:504)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  at com.lidan.xiao.danquestion.activity.QuestionActivity.createView(QuestionActivity.java:176)  at com.lidan.xiao.danquestion.activity.QuestionActivity.access$300(QuestionActivity.java:39)  at com.lidan.xiao.danquestion.activity.QuestionActivity$2.getView(QuestionActivity.java:168)  at android.widget.AdapterViewAnimator.showOnly(AdapterViewAnimator.java:548)  at android.widget.AdapterViewAnimator.setAdapter(AdapterViewAnimator.java:971)  at android.widget.AdapterViewFlipper.setAdapter(AdapterViewFlipper.java:144)  at com.lidan.xiao.danquestion.activity.QuestionActivity.initView(QuestionActivity.java:172)  at com.lidan.xiao.danquestion.activity.QuestionActivity.onCreate(QuestionActivity.java:72)  at android.app.Activity.performCreate(Activity.java:5990)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2280)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)  at android.app.ActivityThread.access$800(ActivityThread.java:153)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5293)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  Caused by: android.content.res.Resources$NotFoundException: Resource "android:style/Widget.Material.Light.ProgressBar.Horizontal" (10302b8) is not a Drawable (color or path): TypedValue{t=0x1/d=0x10302b8 a=-1 r=0x10302b8} at android.content.res.Resources.loadDrawableForCookie(Resources.java:2441) at android.content.res.Resources.loadDrawable(Resources.java:2381) at android.content.res.TypedArray.getDrawable(TypedArray.java:749) at android.widget.ProgressBar.
(ProgressBar.java:267) at android.widget.ProgressBar.
(ProgressBar.java:253) at android.widget.ProgressBar.
(ProgressBar.java:249) at java.lang.reflect.Constructor.newInstance(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)  at android.view.LayoutInflater.createView(LayoutInflater.java:607)  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.inflate(LayoutInflater.java:504)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  at com.lidan.xiao.danquestion.activity.QuestionActivity.createView(QuestionActivity.java:176)  at com.lidan.xiao.danquestion.activity.QuestionActivity.access$300(QuestionActivity.java:39)  at com.lidan.xiao.danquestion.activity.QuestionActivity$2.getView(QuestionActivity.java:168)  at android.widget.AdapterViewAnimator.showOnly(AdapterViewAnimator.java:548)  at android.widget.AdapterViewAnimator.setAdapter(AdapterViewAnimator.java:971)  at android.widget.AdapterViewFlipper.setAdapter(AdapterViewFlipper.java:144)  at com.lidan.xiao.danquestion.activity.QuestionActivity.initView(QuestionActivity.java:172)  at com.lidan.xiao.danquestion.activity.QuestionActivity.onCreate(QuestionActivity.java:72)  at android.app.Activity.performCreate(Activity.java:5990)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2280)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)  at android.app.ActivityThread.access$800(ActivityThread.java:153)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5293)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

QuestionActivity.java:176)对应的是

root = LayoutInflater.from(QuestionActivity.this).inflate(R.layout.queitem, null);

从而看出是queitem.xml中问题,这个文件有两个(一般和V21,SDK5.0)。在其中搜Widget.Material.Light.ProgressBar.Horizontal。(V21中存在)

这句话android:progressDrawable="@android:style/Widget.Material.Light.ProgressBar.Horizontal"为什么会报错呢?

之前能用,现在不能,应该是android新旧版本不兼容bug。网上正确用法如下。

 

解决:

原因:为什么没有模拟器没有报错  是因为API19不会去引用这个布局所以不会报错

之所以运行才报错 是因为这只是一个运行时异常 且符合编译规则,只有运行后才会出错。API5.0的模拟器就会报错。

原代码:

改为

 

转载地址:http://vcaab.baihongyu.com/

你可能感兴趣的文章
nginx Remote Source Code Disclosure and Denial of Service Vulnerabilities
查看>>
Anti-sec安全培训 部分试看视频
查看>>
FreeBSD kernel NFS client local vulnerabilities
查看>>
JXplorer 的简单使用
查看>>
如何启用 LDAP 签名 Windows Server 2008 中
查看>>
获取ngnix,apache,php,mysql的编译参数 zz from xi4oyu
查看>>
使用ettercap嗅探ssh口令
查看>>
Linux下的内网反弹实例
查看>>
Command execution with a MySQL UDF
查看>>
OTPs: Using s/Key with SSH via OPIE
查看>>
使用arpwatch和arping来排查ARP攻击
查看>>
Linux硬件监控方法
查看>>
RSA SecurID Authentication linux sshd PAM deploy
查看>>
转: pam 禁止某些用户使用ssh 远程登录
查看>>
小包优先+web优先+游戏爆发+单IP限速+连接数限制 脚本V2.0
查看>>
Rhel5 配置NTP服务
查看>>
定制rhel的stage2.img/minstg2.img文件
查看>>
ZZ Quick-Tip: Linux NAT in Four Steps using iptables
查看>>
北京的住房公积金是否可用于还外地的房贷
查看>>
mysqlhotcopy 热备工具体验与总结
查看>>