Libpng Error: Not a Png File Error Showing in Android Studio

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

You should follow below steps.

  1. Cut-paste the image on my desktop.

  2. Opened it in an editor saved it as png. without renaming the file
    name
    .

  3. Copy-pasted the .png image into the drawable folder.

You can use cruncherEnabled.

Returns true if the PNGs should be crunched, false otherwise.

android 
{
aaptOptions
{
cruncherEnabled = false
}
}

Hope this helps you.

Android Studio Error - libpng error: Not a PNG file

Well... it's not a PNG file! Or just possibly it's a PNG file but not a supported variant.

If you would like any more info then you will have to upload the file somewhere and then post a link. It's impossible to tell anything more without it.

EDIT: Now that you've uploaded the file, I can see that it's a JPEG! It has a .png extension, but it's not a PNG file.

AAPT err: libpng error: Not a PNG file

At last, I resolved the issue with the help of this link refer link

Goto terminal and execute the below mentioned command to know the details about the issue

gradlew assembleDebug --info

It will show you the info about the issue or warning. In my project i have got some issues like, some files crunching failed issue.

Steps to resolve:

  1. Install the ImageMagick tool download

  2. To remove the iCCP chunk from the PNG image

    Click down the "Shift" key and right click on the folder which is having images

    Select "Open command window here" option

    In the command terminal type mogrify *.png

(e.g. D:\AndroidProjects{your_project_folder}\app\src\main\res\drawable-hdpi>mogrify *.png)


  1. Now go to your project terminal execute the command gradlew assembleDebug --info,Hope all your warnings and failed to convert issues are removed.

android AAPT: libpng error: Not a PNG file

Complete those steps and solve your problem:

1) Cut-paste the image on your desktop.

2) Opened it in an editor saved it as png. without renaming the file name.

3) Copy-pasted the .png image into the drawable folder.

AAPT err: libpng error: Not a PNG file

At last, I resolved the issue with the help of this link refer link

Goto terminal and execute the below mentioned command to know the details about the issue

gradlew assembleDebug --info

It will show you the info about the issue or warning. In my project i have got some issues like, some files crunching failed issue.

Steps to resolve:

  1. Install the ImageMagick tool download

  2. To remove the iCCP chunk from the PNG image

    Click down the "Shift" key and right click on the folder which is having images

    Select "Open command window here" option

    In the command terminal type mogrify *.png

(e.g. D:\AndroidProjects{your_project_folder}\app\src\main\res\drawable-hdpi>mogrify *.png)


  1. Now go to your project terminal execute the command gradlew assembleDebug --info,Hope all your warnings and failed to convert issues are removed.

Android studio How to resolve Error in png files of library added

Try to remove "builds" folders and do rebuild. But soon, the whole thing in a long file name. Read this answer. By the way, you looked logs? Maybe this is not the PNG? You have not sent the log and did not specify the version Gradle.

Believe me, iOS developers have own problems.



Related Topics



Leave a reply



Submit