Gradle生成错误,错误:任务执行失败':app:transformResourcesWithMergeJavaResForDebug'

我更新了Android Studio 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/' } } } 

这是构build结果。

信息:Gradle任务[: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最新date:app:prepareComAndroidSupportPaletteV72221Library最新date:app:prepareComAndroidSupportRecyclerviewV72221Library最新date:app:prepareComAndroidSupportSupportV42221Library最新date:app:prepareComFacebookAndroidFacebookAndroidSdk410Library最新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最新date:app:compileDebugNdk最新date:app:compileDebugSources最新date:app:transformClassesAndResourcesWithExtractJarsForDebug最新date:app:transformClassesWithJarMergingForDebug最新date:app:collectDebugMultiDexComponents UP-TO- DATE: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(지정java. 경로를찾을수없습니다)

信息:BUILD FAILED信息:总时间:5.62秒信息:1错误信息:0警告信息:请参阅控制台中的完整输出

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

最好的祝福。

Solutions Collecting From Web of "Gradle生成错误,错误:任务执行失败':app:transformResourcesWithMergeJavaResForDebug'"

尝试将multiDexEnabled true添加到您的应用程序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' } 

我能够解决我的问题,通过使用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} 

现在我的代码编译为类path'com.android.tools.build:gradle:1.4.0-beta3'我尝试vectorgraphics

我有一些资产的问题。 在我的情况下,我不得不将Gradle版本降级到1.2.3,并再次运行。

排除这些文件在我的第一次尝试…排除文件从我的应用程序,没有做的事情。

毕竟答案试过任何人都无法工作,只有在无效的caching/重新启动按工作后才工作。 提到:上面的回答,我包括不要从我的项目中删除。

  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 } 

path: /platforms/android/build.gradle

对于其他版本:去Android网站https://developer.android.com/studio/releases/gradle-plugin.html#updating-plugin

尝试做:使caching失效并重新启动。

它在我的情况下工作。