Libpng error at :app:mergeDebugResources - Gradle Error 42

android, android-gradle-plugin, android-studio, libpng

Solution

SOLUTION

I tried opening my file (`img_myImage.png`) in Adobe Fireworks, which wouldn't open the file, so I opened it in Photoshop which did work, and then I re-saved it as a `.png` file, which seemed to solve the issue.

Problem

When compiling my app for debug in Android Studio, I get the following error(s): ``` Failed to run command: C:\Users\Farbod\Android-SDK\build-tools\21.1.2\aapt.exe s -i C:\Users\Farbod\AndroidStudioProjects\MyApp\app\src\main\res\drawable-hdpi\img_myImage.png -o C:\Users\Me\AndroidStudioProjects\MyApp\app\build\intermediates\res\debug\drawable-hdpi-v4\img_myImage.png Error Code: 42 Output: C:\Users\Me\AndroidStudioProjects\MyApp\app\src\main\res\drawable-hdpi\img_myImage.png: libpng warning: IDAT: Too many IDATs found libpng error: Read Error :app:mergeDebugResrouces FAILED ``` I've checked that all my files are in a `.png` format, and I'm not sure what could be wrong.

Original source