Android 在APK META-INF/LICENSE.txt中复制了重复的文件。包装选项没有帮助

Android 在APK META-INF/LICENSE.txt中复制了重复的文件。包装选项没有帮助,android,build.gradle,Android,Build.gradle,尽管我读过类似的问题并尝试应用此代码: packagingOptions { exclude 'META-INF/LICENSE.txt' } 在我的应用build.gradle中,我仍然会遇到相同的错误 logcat中的错误消息: Error:Execution failed for task ':kalturaClient:transformResourcesWithMergeJavaResForRelease'. > com.android.build.api.t

尽管我读过类似的问题并尝试应用此代码:

packagingOptions {
    exclude  'META-INF/LICENSE.txt'
}
在我的应用build.gradle中,我仍然会遇到相同的错误

logcat中的错误消息:

    Error:Execution failed for task ':kalturaClient:transformResourcesWithMergeJavaResForRelease'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt
    File1: /home/teo/Documents/AndroidStudioWorkspace/Kaltura/DemoApplication/kalturaClient/libs/commons-codec-1.4.jar
    File2: /home/teo/Documents/AndroidStudioWorkspace/Kaltura/DemoApplication/kalturaClient/libs/commons-httpclient-3.1.jar
我也试图清理项目,但没有运气。 我正在使用Android Studio 1.5.1

我的build.gradle文件是:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.kaltura.activity"
    minSdkVersion 8
    targetSdkVersion 23
}

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

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

}

dependencies {
compile project(':kalturaClient')
compile 'com.android.support:support-v4:23.0.1'
compile files('libs/WidevineDRM-Debug-5.0.0.12188.jar')
compile files('libs/apksigtool.jar')
compile files('libs/commons-codec-1.4.jar')
compile files('libs/commons-httpclient-3.1.jar')
compile files('libs/simple-social-sharing-1.0.0.jar')
compile files('libs/universal-image-loader-1.2.1.jar')
}
试试这个

packagingOptions {
        pickFirst 'META-INF/NOTICE.txt'
        pickFirst 'META-INF/DEPENDENCIES.txt'
        pickFirst 'META-INF/LICENSE.txt'
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
希望它能帮助你。

试试这个

packagingOptions {
        pickFirst 'META-INF/NOTICE.txt'
        pickFirst 'META-INF/DEPENDENCIES.txt'
        pickFirst 'META-INF/LICENSE.txt'
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
希望它能帮助您。

您应该添加

android {
    // Fixed build error : Duplicate files copied in APK META-INF/LICENSE.txt
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }
}
您可以访问的更多详细信息

您应该添加

android {
    // Fixed build error : Duplicate files copied in APK META-INF/LICENSE.txt
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }
}

您可以在发布构建后访问更多详细信息。gradle@IntelliJAmiya文件posted.packagingOptions{exclude'META-INF/DEPENDENCIES'exclude'META-INF/NOTICE'exclude'META-INF/LICENSE.txt'exclude'META-INF/LICENSE.txt}这一个有效!谢谢@IntelliJAmiya:ok,没问题@mt0s:post-your-build。gradle@IntelliJAmiya文件posted.packagingOptions{exclude'META-INF/DEPENDENCIES'exclude'META-INF/NOTICE'exclude'META-INF/LICENSE.txt'exclude'META-INF/LICENSE.txt}这一个有效!谢谢@IntelliJAmiya:ok不是问题@mt0s: