-1

I am new in android programming.I am using Android Studio.I have created a project but when i am going run the project It create's two Error :

Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\User\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42

&

Error:Execution failed for task ':app:mergeDebugResources'.

C:\Users\User\Downloads\SingleGridView\app\src\main\res\drawable\channel9.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\User\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42

How can i solve it? I am using windows 7..

Code here >

int[] pprImg = { R.drawable.image1,
            R.drawable.image2,
            R.drawable.image3,
            R.drawable.channel9

    } ;
Aovin Mahmud
  • 204
  • 3
  • 18

1 Answers1

1

If you are running the Win 7, then check the following points and make it work

Check 1 : This is because generated build file path exceeds 260 characters which windows will not support. Make sure your project path is not too long. Refer From Microsoft , From Stackoverflow

Check 2 : Make sure the ".png" file you are using is actually a PNG file, if not convert it to ".png" file. Because sometimes the actual file format may be ".jpg" or ".psd" and by mistake you renamed it as .png . Double check the extension of the png file you used.

Check 3 : Try renaming your file.

Check 4 : Your image named "channel9.png" , try to rename this image to something like "channel_nine.png", because it ends with "9.png" which may be misunderstood as 9 patch image. Normal PNG File : *.png , 9-Patch File : *.9.png

Check 5 : Adjust your build.gradle to use buildToolsVersion "22.0.0" or "22.0.1"

Check 6 : If you do Check 5 - Try to change all your dependencies to point 22.0.x

Check 7 : Clean your Project.

Check 8 : Rebuild your Project.

Hope this helps you in solving the error.

Community
  • 1
  • 1
Swaminathan V
  • 4,663
  • 2
  • 22
  • 32