Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio crash (aapt.exe returns 42) when I put PNG file in drawable folder

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
like image 639
Sherif Reda Avatar asked Mar 13 '15 02:03

Sherif Reda


2 Answers

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

Android Studio - Unable to open PNG file

like image 50
Herrbert74 Avatar answered Sep 21 '22 13:09

Herrbert74


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"

like image 44
BrentM Avatar answered Sep 21 '22 13:09

BrentM