Gradle构建错误,错误:任务执行失败’:app:transformResourcesWithMergeJavaResForDebug’

我已经更新了Android工作室1.4版,也更新了gradle版本(1.4.0-beta3)。

这是我的build.gradle文件

// 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/' } } } 

这是构建结果。

信息:Gradle任务[:app:generateDebugSources,:app:generateDebugAndroidTestSources,:app:assembleDebug]:app:preBuild UP-TO-DATE:app:preDebugBuild UP-TO-DATE:app:checkDebugManifest:app:preReleaseBuild UP-TO-日期: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最新消息: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-日期:app:transformClassesWithMultidexlistForDebug UP-TO-DATE:app:transformClassesWithDexForDebug UP-TO-DATE:app:processDebugJavaRes UP-TO-DATE:app:transformResourcesWithMergeJavaResForDebug FAIL ED

错误:任务’: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(지정된) 경로를찾을수없습니다)

信息:BUILD FAILED信息:总时间:5.62秒信息:1错误信息:0警告信息:在控制台中查看完整输出

问题是什么? 感谢您的关注,我期待着您的回复!

最好的祝福。

Solutions Collecting From Web of "Gradle构建错误,错误:任务执行失败’:app:transformResourcesWithMergeJavaResForDebug’"

尝试将multiDexEnabled true添加到您的app build.gradle文件中。

  defaultConfig { multiDexEnabled true } 

我没有尝试,但它在这里标记为答案

这对我有用,将它添加到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' } } 

我已经解决了这个问题,只需添加

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

我能够通过在“app”文件夹下使用packagingOptions进入build.grade来解决我的问题。 进入那个packagingOptions文件夹我做了以下几点:

排除了项目失败时出现在grade.console上的消息。

例如:如果你的gradle控制台失败,它表示由于META-INF / XXX而无法执行,所以你能做的就是

 android { packagingOptions { exclude 'META-INF/XXX' } 

将其添加到“app”文件夹下的build.gradle。

我用过这个组合

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

 buildToolsVersion "22.0.1" 

 compileSdkVersion 22 targetSdkVersion 22 

  defaultConfig { multiDexEnabled true} 

现在我的代码编译为classpath’com.android.tools.build:grad:1.4.0-beta3’我尝试矢量图形

我遇到了一些资产问题。 在我的情况下,我不得不将Gradle版本降级到1.2.3并再次起作用。

在我的第一次尝试中排除这些文件…排除了我的应用程序中没有成功的文件。

毕竟答案尝试后无法正常工作,只有在无效缓存/重启后才能工作。 提到:我所包含的上述答案不要从我的项目中删除。

  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 

这将是一个答案。

在此处输入图像描述

添加后,在根项目中执行./gradlew clean

 defaultConfig { multiDexEnabled true } 

更新您的依赖项:

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

路径: /platforms/android/build.gradle

其他版本:访问android网站https://developer.android.com/studio/releases/gradle-plugin.html#updating-plugin

尝试执行:使缓存无效并重新启动。

它适用于我的情况。