Android Studio Add PNG image error reason

Source: Internet
Author: User

Today, I saw an Android post on the internet about splash activity, and the blogger gave the code after an explanation. So the decisive download down to see how to achieve. Step by step follow the process to implement this function again. Everything is not a big problem, but during the Gradle compile prompt error:

Libpng error:not a PNG file

It is clear from the tips that the added resources are not in PNG format. But I looked at the files under the Resource folder, all at the end of the PNG format. After a search on the internet on StackOverflow found a post said: Do not just see the file name is *.png end, and to see the actual format is not PNG format. What do you think? There is a way to open the file directly with the hex editor to see if the first few characters are ". png". As follows:

There is also an easy way to open these image files with picture Viewer one by one and then save them in PNG format. This method, whether or not, are saved again is foolproof, of course, the workload relative also handed over.

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

Iccp:not Recognizing known SRGB profile it has been edited

This error occurs because the packaging tool in the high version of the Android SDK AAPT upgrades the libpng package, which is very strict with the PNG format, so one solution is to reduce the compile SDK Version, Use the lower version of the SDK tool to compile and package. Of course, there are other ways to solve this problem: Use the picture editing software to get rid of the meta-data in the picture:

  • ImageMagick
  • Imageoptim

Android Studio Add PNG image error reason

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.