Android Studio Error:Execution failed for task ':app:packageDebug'.

来源:互联网 发布:轻松工程测量系统算法 编辑:程序博客网 时间:2024/05/21 09:12
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE
File 1: E:\workplace\Ninebot\app\libs\apache-mime4j-0.6.jar

File 2: E:\workplace\Ninebot\app\libs\httpmime-4.0.jar

因为apache-mime4j-0.6.jar  httpmime-4.0.jar包太旧 所以要对他们进行兼容

将下面代码加入Project Gradle就可以

  packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'

exclude 'META-INF/license.txt'

        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
       
    }



0 0