Tag Archives: PNG

Error reason for adding PNG pictures in Android studio

    Today, I saw an Android post about splash activity on the Internet. The blogger also gave the code after an explanation. So I decisively downloaded it to see how to achieve it. This function is implemented step by step according to the process. There are no major problems, but an error is prompted during gradle compilation:

libpng error: Not a PNG file

    From the prompt, it is very concise and clear. The added resources do not belong to PNG format. But I looked at the files in the resource folder. They all end in PNG format. After searching the Internet, I found a post on stackoverflow saying: don’t just look at the end of the file name *. PNG, but look at whether the actual format is PNG format. What do you think?There is a way to open the file directly with a hexadecimal editor to see if the first few characters are “. PNG”. As follows:

    In addition, there is a simple way to open these picture files one by one with the picture viewer, and then save them as PNG format files. This method, whether it is or not, is safe to save it again. Of course, the workload is also relatively handed over

    In the process of using PNG pictures, you may also encounter the following error prompts:

iccp:Not recognizing known sRGB profile that has been edited

The reason for this error is that the packaging tool AAPT in the higher version Android SDK has upgraded the libpng package. The toolkit has very strict requirements on the PNG format. Therefore, one solution is to reduce the compile SDK version and use the lower version SDK tool for compilation and packaging. Of course, there are other ways to solve this problem: use the image editing software to remove the metadata in the image:

ImageMagick

ImageOptim