libpng error: Not a PNG file Error Showing In Android Studio

后端 未结 8 2096
悲哀的现实
悲哀的现实 2020-11-27 05:20

I just Imported a project from Eclipe to Android Studio. Just a plain and simple project. But the project folder is showing one error .

May I know what

相关标签:
8条回答
  • 2020-11-27 05:36

    Try to use another png files. It seems something wrong with png's metadata. I had the same issue. Then I used some other png files and it fixed my issue.

    0 讨论(0)
  • 2020-11-27 05:37

    Try this in build.gradle

    android {
        ....
        aaptOptions {
            cruncherEnabled = false
        }
        ....
    }
    
    0 讨论(0)
  • 2020-11-27 05:39

    "PNG" in the error is clearly written in caps. So you need to see that the image has .PNG extension (in Capital).

    Step 1: Open the image in Paint.

    Step 2: Save the image Save as .PNG shown as below Click here to see how to save the image in PNG

    Step 3: Refresh your project

    Step 4: You should see like this -> See here

    Please do reply if the issue is still not resolved

    0 讨论(0)
  • 2020-11-27 05:45

    Try run command

    find . -type f -name "*.png" | xargs -L 1 -I{} file  -I {} | grep -v 'image/png; charset=binary$'
    

    in your root project directory, it will show you all files that have .png extension, but are not pngs. Then you can resave them as png in some image editor. Before running this command clean project, to speed up the process.

    0 讨论(0)
  • 2020-11-27 05:45

    As for me, what was happening is that I cloned the repository on Windows, and those PNG files were symlinks in Linux/Mac, but on Windows they were just invalid files. Once I did proper copies of the files instead of being symlinks, the build worked.

    0 讨论(0)
  • 2020-11-27 05:49

    It might be because of renaming problem of the Image just cut the images and paste any where in the system and open each with the respective editor and save as the same but of PNG format and then copy and paste again to drawable folders. It works for me

    AND PLEASE LOOK AT THE ISSUE WHICH I SUBMITTED TO THE ANDROID STUDIO TEAM

    Hope it will help you all .

    0 讨论(0)
提交回复
热议问题