报错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目录下问题更容易发现问题:

Caused by: android.content.res.Resources$NotFoundException:

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

相关文章:

  • 2021-07-24
  • 2021-12-01
  • 2021-09-25
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2021-05-19
  • 2021-11-28
  • 2021-08-01
  • 2022-12-23
  • 2021-07-13
  • 2021-11-11
  • 2021-09-10
相关资源
相似解决方案