Duplicate files copied in APK META-INF/license.txt
来源:互联网 发布:java this super 编辑:程序博客网 时间:2024/05/16 05:16
今天在尝试使用AndroidAnnotations框架的REST API时,在导入Spring for android包后仅编译的话不会报错,但是当运行时无法编译通过,并报一下错误:
<span style="font-size:18px;">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.txtFile1: C:\Users\sea\.gradle\caches\modules-2\files-2.1\org.springframework.android \spring-android-rest-template\1.0.1.RELEASE\e132d929bd181941f79b0d63edafb8a86ae6fd33 \spring-android-rest-template-1.0.1.RELEASE.jarFile2: C:\Users\sea\.gradle\caches\modules-2\files-2.1\org.springframework.android \spring-android-core\1.0.1.RELEASE\e68f0e8e4b636ee30c4de58953be38d9b72a5e3b \spring-android-core-1.0.1.RELEASE.jar</span>解决办法是在Model的build.gradle中添加一下内容:
android { packagingOptions { exclude 'META-INF/LICENSE.txt' }}与之类似的,可以把完整的加进去
android { 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' }}
按照stackoverflow上回答的问题原因是:
Almost all OS licence include the obligation to "include a copy of the licence" into your project. So this means, that you have to include a copy of all OS licences you use into you projects. By "excluding" them in gradle, you violate the licences.
0 0
- Duplicate files copied in APK META-INF/license.txt
- Duplicate files copied in APK META-INF/LICENSE.txt
- Duplicate files copied in APK META-INF/LICENSE.txt
- Duplicate files copied in APK META-INF/LICENSE.txt
- Duplicate files copied in APK META-INF/license.txt
- Duplicate files copied in APK META-INF/LICENSE的解决方案
- Duplicate files copied in APK META-INF/LICENSE
- Duplicate files copied in APK META-INF/LICENSE
- Android解决Duplicate files copied in APK META-INF/LICENSE
- DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
- 解决Duplicate files copied in APK META-INF/LICENSE
- Duplicate files copied in APK META-INF/LICENSE.txt解决方式
- Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt
- android stuido 编译报 Duplicate files copied in APK META-INF/LICENSE.txt 问题
- Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt
- Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt
- Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt
- android studio---Duplicate files copied in APK META-INF/LICENSE.txt 错误解决
- Alcatraz install 安装步骤
- Swift 1.构造函数-必选属性
- strcmp && strcpy && strlen && strcat 源码
- 开发笔记 - 设置NSZombieEnabled调试EXC_BAD_ACCESS
- 网络知识点
- Duplicate files copied in APK META-INF/license.txt
- Swift之小项目实战
- CPU寄存器操作方式
- Ubuntu下使用Vi是方向键变乱码 退格键不能使用的解决方法
- QT 编写xml文件实例
- MapReduce算法设计-计算单词共现矩阵
- 汇编复习————指令集
- arm7 中为啥pc等于当前指令+8
- Swift 2.构造函数-子类构造