android - 我在添加 Creative SDK 依赖项时遇到错误错误 :Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'

标签 android firebase android-gradle-plugin maven-3 adobecreativesdk

我正在使用 firebase 和 creative SDK 创建一个应用程序,起初我添加了 firebase 依赖项并且它没有任何问题。之后我添加了创意 sdk 的依赖项并遇到了一些问题。

我在构建项目时遇到错误

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.txt File1: C:\Users\Tharaka.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.4\5fe28b9518e58819180a43a850fbc0dd24b7c050\commons-lang3-3.4.jar File2: C:\Program Files\Android\Android Studio\gradle\m2repository\commons-io\commons-io\2.4\commons-io-2.4.jar

这是我的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.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        /* 1) Add the Gradle Retrolambda Plugin */
        classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta3'
    }
}

allprojects {
    repositories {
        jcenter()
        /* 2) Add mavenCentral */
       // mavenCentral()

        /* 3) Add the Creative SDK Maven repo URL */
        maven {
            url 'https://repo.adobe.com/nexus/content/repositories/releases/'
        }
        maven {
            url 'http://dl.bintray.com/raphaelbussa/maven'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

和我的应用程序 gradle 文件

apply plugin: 'com.android.application'

/* 1) Apply the Gradle Retrolambda Plugin */
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.sliit.dailyselfie"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    /* 2) Compile for Java 1.8 or greater */
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        pickFirst 'AndroidManifest.xml'


    }

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

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
    compile 'com.github.supervital:swipenumberpicker:1.0.3'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.android.support:recyclerview-v7:23.2.1'
    compile 'com.wrapp.floatlabelededittext:library:0.0.6'
    compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
    compile 'com.firebase:firebase-client-android:2.3.1'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'info.hoang8f:fbutton:1.0.5'
    compile 'com.roughike:bottom-bar:1.2.4'
    compile 'rebus:bottom-dialog:0.0.5'

    compile 'com.adobe.creativesdk.foundation:auth:0.9.7'
    compile 'com.adobe.creativesdk:image:4.4.8'
}

最佳答案

这个已经有人回答了,但是答案好像消失了……以防万一:

尝试从您的 gradle 配置中删除这一行:

exclude 'META-INF/LICENSE.txt'

之后,尝试在 Android Studio 中清理/重建项目。

关于android - 我在添加 Creative SDK 依赖项时遇到错误错误 :Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36597089/

相关文章:

android - Mediaplayer 准备显示非法状态异常

android - 如何使用 OpenCV 从图像中检测(计数)头发?

firebase - 在构建时,StreamBuilder被多次调用

ios - 我应该删除生产的firebase调试吗

安卓工作室 - 错误 :Unable to load class 'org.slf4j.LoggerFactory'

android - 错误 : JNI ERROR (app bug): accessed stale global reference

android - 删除删除异常?

swift - 实例成员存储不能用于 StorageReference 类型

android - 使用 tasks.getByName 找不到名称的任务

Android Gradle Build Plugin 4.0.0 & R8 Desugaring 不适用于 API 19