18

I have search all the possible available solution but still i am facing same issue with unclear error for me.

Now the complete error is-

AAPT err(Facade for 370671127): libpng error: Not a PNG file Error:Execution failed for task ':app:mergeDebugResources'.

Some file crunching failed, see logs for details

Now from this line libpng error: Not a PNG file actual i am not getting where is the problem exist either in my any image files or anything else except this.

1- Before posting this issues i have changed my all the images existing in the diff-2 folders in required PNG formates as I see as solution in other post.

Note- Its working fine on eclipse now I am importing this in Android Studio.

Since during project build only single(above) error is shown so I guess there is not should be any other issue. I have spend more time to resolve this issues so all the suggestions are welcomes for me.

admaurya
  • 181
  • 1
  • 1
  • 3
  • remove recently added png file in your drawable or mipmap – Sathish Kumar Dec 11 '15 at 07:36
  • @Sathish now i am getting the same old issues but with slightly diff. **AAPT err(Facade for 1757240286): D:\AndroidStudio\Workspace\VikramSingh1\app\src\main\res\drawable\calendar_tile_small.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited** – admaurya Dec 11 '15 at 07:42
  • have you edited your png in MS paint?, Coz i got that issue when i edited on MS paint. – Sathish Kumar Dec 11 '15 at 07:48
  • No, I have edited my all the images in adobe photoshop. after edit all the above error has been removed except single one which I have post. – admaurya Dec 11 '15 at 07:56
  • seems to be a bug in the new gradle 2 alpha. not sure if you use that one. have a look at https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=195047#makechanges – Gillis Haasnoot Dec 26 '15 at 21:58

2 Answers2

21

The problem is in your png files. Probably you images were optimized by some png optimization tools. Android tools use AAPT tool to optimize images during building your project. The reason for this problem is that AAPT tool doesn't know that you preprocessed the image.

To get around this in your application you need to specify the option in gradle

  aaptOptions{
    cruncherEnabled = false
}

This is disable AAPT optimization for all of your png files.

Similar question was asked here.

Volodymyr
  • 6,393
  • 4
  • 53
  • 84
5

Although there can be various reasons for this error , i.e Can't resolve symbol R

But In particular, If the problem is saying Not a PNG file

My Case

For me ,it was a jpeg file that I had saved with extension .png which was the root cause

Solution

remove that jpeg image from your res/drawable folder

Note

renaming a jpeg to png doesn't mean it is a png in android studio... so get rid of that jpeg image

rebuild..

voila.. it works

hope it helps :)

eRaisedToX
  • 3,221
  • 2
  • 22
  • 28
  • 4
    this will not help much as the name of the file to be changed from .jpeg to .png is not mentioned in the error logs. you can rename a specific file only if the file name is posted in error log. and since it is not there, its still an issue. – AADProgramming May 13 '16 at 06:07