Android Studio 运行出现 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForD

Posted Edwin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android Studio 运行出现 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForD相关的知识,希望对你有一定的参考价值。

 

 

 


我引用compile \'com.squareup.retrofit2:converter-jackson:2.1.0\'Gradle没有错误,运行APP就出了这个error。

 

 

错误日志Error:Execution failed for task \':app:transformResourcesWithMergeJavaResForDebug\'.> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE

 

 


解决方法如下:

 

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.edwin.xxxx"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

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

    packagingOptions{
        exclude \'META-INF/NOTICE\' // will not include NOTICE file
        exclude \'META-INF/LICENSE\' // will not include LICENSE file
        // as noted by @Vishnuvathsan you may also need to include
        // variations on the file name. It depends on your dependencies.
        // Some other common variations on notice and license file names
        exclude \'META-INF/notice\'
        exclude \'META-INF/notice.txt\'
        exclude \'META-INF/license\'
        exclude \'META-INF/license.txt\'
    }
}

 

 

 

以上是关于Android Studio 运行出现 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForD的主要内容,如果未能解决你的问题,请参考以下文章

android studio日志问题见图。

android studio出现Error:compileSdkVersion android-x requires compiling with JDK 7问题

Android Studio 报出此错AAPT: error: unexpected element <intent-filter> found in <manifest><application>.

在模拟器上运行Android项目时报错:DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs

android studio安卓项目出现Error: Default Activity Not Found错误无法编译的解决方案

android studio 刚安装后创建了一个project 然后run模拟器 就出现这个问题求解答