Android Studio Error - libpng error: not PNG file

I got an error with Android Studio. Do you guys know how to solve it?

I already checked if the files exist. They make. I already checked the image format and also saved it in png. I am still getting the following error. What could it be?

--- Error ---

: application: mergeDebugResources libpng error: not PNG file

Error: failed to execute the command: C: \ Users \ Kharlo PC \ AppData \ Local \ Android \ android-studio1 \ sdk \ build-tools \ android-4.4W \ aapt.exe s -i D: \ XfixedOdometer \ app \ src \ main \ res \ drawable- hdpi \ ic_launcher.png -o D: \ XfixedOdometer \ app \ build \ intermediates \ res \ debug \ drawable-hdpi-v4 \ ic_launcher.png

Error Code: 42

Conclusion: libpng error: not PNG file

Thanks in advance:)

+5
source share
2 answers

Well ... this is not a PNG file! Or maybe it's a PNG file, but not a supported option.

If you need more information, you will have to download the file somewhere, and then send the link. It is impossible to tell anything without him.

EDIT: now that you have downloaded the file, I see that it is JPEG! It has a .png extension, but it is not a PNG file.

+8
source

Although there can be different reasons for this error, i.e. Unable to resolve character R

But in particular, if the problem says Not a PNG file

My case

For me it was a jpeg file that I saved with the extension .png which was the main reason

Decision

delete this jpeg image from res / drawable folder

Note renaming jpeg to png does not mean that it is png in android studio ... so get rid of this jpeg image

recovery ..

voila .. it works

hope this helps :)

0
source

Source: https://habr.com/ru/post/1203060/


All Articles