6

After yesterday's update it won't build or run project with these 2 PNG images as background image. As soon as I delete these images everything works fine again (I put images in drawable folder).

:app:mergeDebugResources FAILED
C:\Users\Daedlues\Desktop\Android-Studio-Projects\AndroidInterView\app\src\main\res\drawable\middle.png
Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Daedlues\Desktop\Work\SDK\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42
Error:Execution failed for task ':app:mergeDebugResources'.
> C:\Users\Daedlues\Desktop\Android-Studio-Projects\AndroidInterView\app\src\main\res\drawable\middle.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Daedlues\Desktop\Work\SDK\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42
Information:BUILD FAILED
Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
Sherif Reda
  • 121
  • 1
  • 2
  • 3

7 Answers7

13

This can also happen if you exceed the Windows max path length.

Android Studio - Unable to open PNG file

Community
  • 1
  • 1
Herrbert74
  • 2,578
  • 31
  • 51
4

If 'yesterdays update' refers to Android 5.1 (API 22) then try using the latest version of the build tools. Adjust your build.gradle to use buildToolsVersion "22.0.0"

BrentM
  • 5,671
  • 3
  • 31
  • 38
2

In my case, it turned out that the "png" image was really a "psd" image that simply had the wrong extension. I had to convert it to a "png" and then the error went away.

yarell
  • 444
  • 4
  • 5
0

This can happen when gradle fails to process resources.

In my case it happened to be an invalid image file in the drawable folder, that's why my XML layouts that Android Studio didn't pick up on ... for that solution i am prefer both ways

1> check your extension & convert them .png into .jpeg

2> if that useless then delete from drawable

Dhruv Raval
  • 4,946
  • 3
  • 29
  • 34
0

Check the image middle.png. if it is an image with format jpg or jpeg,that is the reason.

snowdream
  • 933
  • 2
  • 13
  • 27
0

I had the same problem and doing a ./gradle clean build solved it !

Dico
  • 320
  • 4
  • 7
0

We got this error message too. For some reason, our files were named foo.9.png - and the extra dot tripped up the build. So, check if you have any superfluous dots in the file name too.

Magnar
  • 28,550
  • 8
  • 60
  • 65