0

I'm unable to set my MainActivity background from a drawable image:

android:background="@drawable/loli"

loli is my drawable name. Actually nothing special, just the usual to get a simple background. When I use it my xml, I'm getting this error while running:

Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/firas/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 42
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> /home/firas/AndroidStudioProjects/NeverLost/app/src/main/res/drawable/back.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/firas/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 42
Arnaud
  • 7,259
  • 10
  • 50
  • 71

3 Answers3

1

This can happen when gradle fails to process resources. In your case it may have happened to be an invalid image file in the drawable folder.

Please check both ways

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

2> if that useless then delete from drawable

Please visit Android Studio Error: org.gradle.process.internal.ExecException or this link for more help Android Studio crash (aapt.exe returns 42) when I put PNG file in drawable folder

Community
  • 1
  • 1
Mohammad Tauqir
  • 1,817
  • 1
  • 18
  • 53
0

Try cleaning/rebuilding your project.

Build > Clean Project or Build > Rebuild Project

ayz4sci
  • 2,220
  • 1
  • 16
  • 17
0

Thank you everyone for your answers the links you provide me were very useful (first one). actually the problem was not changing the image extension . because I was saving .jpeg extensions as .png from google image I think it's much suitable to keep the default extension . At least that worked for me