android重复的文件复制APK META-INF许可证错误记录

* What went wrong:
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
File1: C:\AndroidStudio\Umer_Doctor\app\libs\httpmime-4.3.5.jar
File2: C:\AndroidStudio\Umer_Doctor\app\libs\httpcore-4.3.2.jar


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

这个是当时抛出的异常信息,很奇怪,下面是解决方案(如果有更了解的人欢迎详细解说下,互相学习)

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/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
View Code

这个是完整的解决方案,虽然我不知道这是什么原因,估计是编译器的问题,说不定以后as升级了不会发生,我用的是1.5版本的

android重复的文件复制APK META-INF许可证错误记录_第1张图片

你可能感兴趣的:(android重复的文件复制APK META-INF许可证错误记录)