InflateException: Binary XML file line #8: Error inflating class ImageView

前端 未结 14 2143
忘掉有多难
忘掉有多难 2020-12-03 06:56

I know there are other questions on SO asking the same thing. I have already looked at most of them.

Most answers call about memory errors. I can\'t see how an

14条回答
  •  醉话见心
    2020-12-03 07:21

    I had the same problem. The png image for my imageView was causing a class inflateException. This was only happening with my phone running android 6.0.1, but not in my phone running android 7.0. To solve this:

    ---In Android Studio---

    • Deleted the png image from the drawable folder (I only have the drawable folder visible, not the drawable-v24).
    • Copy the png back to the drawable folder. When doing this, you'll be able to pick to copy it to either the drawable or drawable-v24 folder. Copy the png to both folders
    • Copy the png to both folders (png's must have same name).
    • Once you copy the png to both folders, a new folder with the png's name will show up. Inside it you will see the 2 png's. One with "(v24)" next to it. New folder with name of png's will appear, containing png's

提交回复
热议问题