25

please help me!

here is error says:

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

Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

my app gradle is :

apply plugin: 'com.android.application'
android {
  compileSdkVersion 25
  buildToolsVersion "25.0.1"
  packagingOptions {
    exclude 'META-INF/NOTICE' // will not include NOTICE file
    exclude 'META-INF/LICENSE' // will not include LICENSE file
  }
defaultConfig {
    applicationId "com.aku.ec2ainun.stepondesign"
    minSdkVersion 18
    targetSdkVersion 25
    versionCode 1
    versionName "1.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}
dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
   androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/slider.jar')
}
apply plugin: 'com.google.gms.google-services'

my project gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.google.gms:google-services:3.0.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
 }
}
allprojects {
  repositories {
    jcenter()
 }
}
task clean(type: Delete) {
   delete rootProject.buildDir
}
Simon Schnell
  • 1,160
  • 14
  • 24
ec2ainun
  • 261
  • 1
  • 4
  • 8
  • Please post the rest of the error message. The important part is in the beginning. – Neria Nachum Dec 11 '16 at 09:23
  • @NeriaNachum : here is all the console says : http://prnt.sc/di0brd – ec2ainun Dec 11 '16 at 10:52
  • This is not the whole error. Copy the entire message in the left box. – Neria Nachum Dec 11 '16 at 11:14
  • @NeriaNachum: no, that all the error i have, here is the pic : http://prnt.sc/di7hzn – ec2ainun Dec 11 '16 at 21:03
  • "See completely output in console"... That's what it also says – OneCricketeer Dec 11 '16 at 21:28
  • File->Invalidate cache and restart – Mushirih Dec 11 '16 at 21:36
  • @NeriaNachum : http://prnt.sc/dib3rl and this one, http://prnt.sc/dib3sm – ec2ainun Dec 12 '16 at 03:27
  • @cricket_007: http://prnt.sc/dib3rl and this one, http://prnt.sc/dib3sm its from gradle console with stacktrace and debug grade – ec2ainun Dec 12 '16 at 03:28
  • @PeterMushirih : just already do it, but doesn't work – ec2ainun Dec 12 '16 at 03:28
  • There are plenty of potential solutions here: http://stackoverflow.com/questions/35890257/android-errorexecution-failed-for-task-apptransformclasseswithdexforrelease – Neria Nachum Dec 12 '16 at 09:02
  • 1
    Try to modify 'com.android.tools.build:gradle:2.2.3' to 'com.android.tools.build:gradle:2.2.2' with your project gradle, and rebuild your project. There will be a more specific message. I think there are some log print bug exist in 2.2.3 release of gradle. – Dot1q84 Dec 15 '16 at 01:29
  • If you changed the image extension then put it back to the original form and rebuild the project... – Kuldip satpute Dec 31 '16 at 15:30
  • this issue arises when some of your resources are corrupted. Make sure all your images are readable. I encountered this problem when I was saving icons directly from browser to "res" folders. – neilQ5 May 17 '18 at 16:20
  • Please see my answer to this question: https://stackoverflow.com/a/66520627/11142666. The issue my be related to an older processor that is no longer supported by Android Studio. – Vijayendra Vasu Mar 07 '21 at 19:41

13 Answers13

60

Try code on your module build.gradle:

android {
// ...
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
// ...
}

It means Android studio DO NOT check PNG strictly.

刘晓飞
  • 750
  • 5
  • 9
  • 2
    Thanks. Instead of switching jpg 2 png by renaming (works for web with a charm) I needed to properly convert it. – Alexander Jun 25 '17 at 18:59
13

I got the same issue after I added 9 patch image in my project. Removing that image solved my problem.

Ahsan Hayat
  • 131
  • 3
  • 3
    I think problem is when we add .9 files and .png file with same name.Although removing .9 file in this case worked for me. – MSN Jan 02 '17 at 03:04
10

I got the same issue when I insert png image to drawable folder. I delete that image,clean project and rebuild it , the issue resolved.This worked for me.

Kamta Sahu
  • 150
  • 1
  • 9
4

Try to check that, if you use a 9-patch image, it is in correct format (with black pixel on the edge and they mustn't touch the pixel of your image). I resolved this problem with changing a 9-patch image that is malformed. In my case the image touched the black pixel of 9-patch e android studio showed that error.

diegocom
  • 338
  • 1
  • 7
  • 22
2

I got this error when I added an image I had saved in gimp as 'filename.9.png' (which I thought was enough to produce a 9-patch image) to the drawable folder. To solve the issue I just opened the image in the Draw 9-patch tool and moved one of the bounds around - it didn't seem to matter whether I moved it back to the same spot, just the act of moving the bounds seems to correct the issue.

Z. Wootton
  • 21
  • 3
  • If you have a new question, please ask it by clicking the [Ask Question](http://stackoverflow.com/questions/ask) button. Include a link to this question if it helps provide context. - [From Review](/review/low-quality-posts/15287907) – Suhaib Janjua Feb 21 '17 at 14:29
  • It wasn't a question, it's a resolution to the issue. – Z. Wootton Feb 21 '17 at 16:25
1

Some times I also get this error

Rebuilding the entire project before running (Build > Rebuild Project) it doesn't show up anymore.

You can try this.

Jogendra Gouda
  • 405
  • 4
  • 17
1

I faced the same issue. I was using *.png files and the gradle Build kept on failing, despite multiple Rebuild-projects. Surprisingly, the moment I changed the file names from *.png to *.jpg, it worked!

1

After struggling a lot I have final solve this issue:

I realize two issue while solving this issue

  1. kindly check each and every XML file check each and every XML tag is properly close or not.
  2. Specially it appear with images kindly remove images and clean project.

Hope it will work for you.

Jose Rodriguez
  • 9,753
  • 13
  • 36
  • 52
Dr.Din
  • 11
  • 1
1

After searching and using lots of suggestions i got a solution for this:

1)I am using nine patch images in my project and android studio doesn't accept abc.9.png image so rename this name to abc.png

2)When i am convert my images to nine patch images one image can't convert properly it shows "Bad Patches" i remove this image and recreate and i solved my problem, this problem is comes when i convert my project eclipse to android studio

3) put this in your gradle aaptOptions.setProperty("cruncherEnabled", false)

Thanks

0

Check your resources, specially the file names. It sucks when android studio does not point out the real reason. It solved my issue.

BST Kaal
  • 2,993
  • 6
  • 34
  • 52
0

In my case I had one 9-patch resource in every screen density drawable folder. Black borders in every resource didn't match eachother so I stretched them up to the very corner, so they all matched.

This is the result:

This is the result.

And then it worked!

Juan José Melero Gómez
  • 2,742
  • 2
  • 19
  • 36
0

Just check Your String which contains another type of

 ( ' )colon ex/. we need ( ' )these but we implement like (’)these in app.

or any other string font.

Done..☻♥

-3

maybe the image issue which u put into the mipmap ,delete the image and retry the gradle sync 汉语 就是你放到mipmap中的图片有问题 把他删了就好了 哎 真为我的英语捉急啊~~

张健龙
  • 27
  • 2