Resources$NotFoundException: Resource "com.test.test:drawable/launch" (7f060058) is not a Drawable

报错log最上面的信息:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.test/com.test.test.LaunchActivity}: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class android.widget.ImageView

往下找到了

Caused by: android.content.res.Resources$NotFoundException: Resource "com.test.test:drawable/launch" (7f060058) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060058 a=-1 r=0x7f060058}

说的是Drawable的错误,Resources$NotFoundException,说Drawable没有找到,但是图片是有的,可为什么找不到呢?将项目结构目录切换到project目录下问题更容易发现问题:

因为Drawable有几个不同的Drawable文件夹,把图片放到了v24包下,但是Drawable下却没有,android7.0也就是API24以下的手机找不到该图片,所以就报错了,搞一张相同的图片放到Drawable下就没问题了!

猜你喜欢

转载自blog.csdn.net/blackei/article/details/95332194
今日推荐