Gradle build error, Error:Execution failed for tas

2019-02-01 08:29发布

问题:

I've updated the Android studio for 1.4, also gradle version updated(1.4.0-beta3).

It is my build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        //classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.android.tools.build:gradle:1.4.0-beta3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        //ViewPagerIndicator
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
}

And this is the build result.

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE :app:prepareComAndroidSupportCardviewV72221Library UP-TO-DATE :app:prepareComAndroidSupportDesign2221Library UP-TO-DATE :app:prepareComAndroidSupportGridlayoutV72221Library UP-TO-DATE :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportPaletteV72221Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72221Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE :app:prepareComFacebookAndroidFacebookAndroidSdk410Library UP-TO-DATE :app:prepareComGithubLawloretienneQuickreturn001Library UP-TO-DATE :app:prepareComGithubRey5137Material121Library UP-TO-DATE :app:prepareComKakaoSdkAuth112Library UP-TO-DATE :app:prepareComKakaoSdkKakaolink112Library UP-TO-DATE :app:prepareComKakaoSdkKakaostory112Library UP-TO-DATE :app:prepareComKakaoSdkKakaotalk112Library UP-TO-DATE :app:prepareComKakaoSdkUsermgmt112Library UP-TO-DATE :app:prepareComKakaoSdkUtil112Library UP-TO-DATE :app:prepareComViewpagerindicatorLibrary241Library UP-TO-DATE :app:prepareComWefikaFlowlayout030Library UP-TO-DATE :app:prepareDeHdodenhofCircleimageview130Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:prepareComAndroidSupportMultidexInstrumentation101Library UP-TO-DATE :app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl UP-TO-DATE :app:processDebugAndroidTestManifest UP-TO-DATE :app:compileDebugAndroidTestRenderscript UP-TO-DATE :app:generateDebugAndroidTestBuildConfig UP-TO-DATE :app:generateDebugAndroidTestAssets UP-TO-DATE :app:mergeDebugAndroidTestAssets UP-TO-DATE :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources UP-TO-DATE :app:mergeDebugAndroidTestResources UP-TO-DATE :app:processDebugAndroidTestResources UP-TO-DATE :app:generateDebugAndroidTestSources UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:transformClassesAndResourcesWithExtractJarsForDebug UP-TO-DATE :app:transformClassesWithJarMergingForDebug UP-TO-DATE :app:collectDebugMultiDexComponents UP-TO-DATE :app:transformClassesWithMultidexlistForDebug UP-TO-DATE :app:transformClassesWithDexForDebug UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForDebug FAILED

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

java.io.FileNotFoundException: D:\Develop\workspace\b2c\Apps\app-meterial\app\build\intermediates\transforms\RESOURCES\FULL_PROJECT\mergeJavaRes\debug\META-INF\license\LICENSE.base64.txt (지정된 경로를 찾을 수 없습니다)

Information:BUILD FAILED Information:Total time: 5.62 secs Information:1 error Information:0 warnings Information:See complete output in console

What is the problem? Thank you for your attention, I'll be looking forward to hearing from you!

Best Regards.

回答1:

Try adding multiDexEnabled true to your app build.gradle file.

 defaultConfig {
    multiDexEnabled true
}

I did not try but It marked as answer at here



回答2:

This is what worked for me, added it into build.gradle:

android {
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
        }
    }


回答3:

i had solve this issue,just add

packagingOptions{
   //  this is my setting:
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
  //  you should 
    exclude 'META-INF/license\LICENSE.base64.txt'
}


回答4:

I was able to fix my problem by using packagingOptions into my build.grade under "app" folder. into that packagingOptions folder I did the following:

I EXCLUDED the message that was appearing on my grade.console whenever the project was failing.

For instance: if when your gradle console fails it says it could not execute because of META-INF/XXX so what you can do is

android { 

  packagingOptions  {

        exclude 'META-INF/XXX'
 }

Add it to the build.gradle under "app" folder.



回答5:

I used this combination

           buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        minifyEnabled false
    }
}

and

buildToolsVersion "22.0.1"

with

compileSdkVersion 22
targetSdkVersion 22

and

   defaultConfig {   multiDexEnabled true}

And now my code compile for classpath 'com.android.tools.build:gradle:1.4.0-beta3' I try Vector graphics



回答6:

After all answer tried can't work anyone, only work after invalid caches/restart press it work. mention that: Above answer that i include don't remove from my project.

 packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'

    }
 multiDexEnabled true

so that would be a answer.



回答7:

perform ./gradlew clean in your root project after adding

defaultConfig {
    multiDexEnabled true
}


回答8:

I had the problem with some assets. In my case I had to downgrade the Gradle version to 1.2.3 and it worked again.

Excluding those files in my first attempt well...excluded the files from my app which didn´t make the thing.



回答9:

Update your dependencies:

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
    **classpath 'com.android.tools.build:gradle:VERSION'**  Look for your build tools update
}

Path: /platforms/android/build.gradle

for other versions: go to android website https://developer.android.com/studio/releases/gradle-plugin.html#updating-plugin



回答10:

Try doing: Invalidate caches and Restart.

It worked in my case.