duplicate files during packaging of apk
OSChina Android APP 导入到Android Studio中不能运行,发现一小插曲。
主要实现了开源中国社区 OSC Android 客户端项目源码通过Gradle方式编译 在 Android Studio运行并模拟。
出现这个报错:
Error:duplicate files during packaging of APK /Users/lixiphp/AndroidStudioProjects/oschina-android/app/build/outputs/apk/app-debug-unaligned.apk
Error:Execution failed for task ‘:app:packageDebug’.
> Duplicate files copied in APK META-INF/NOTICE.txt
File 1: /Users/lixiphp/AndroidStudioProjects/oschina-android/app/libs/commons-httpclient-3.1.jar
File 2: /Users/lixiphp/AndroidStudioProjects/oschina-android/app/libs/commons-httpclient-3.1.jar
这个APP运行的环境是在SDK API 15,如果你改为19或者更高是会报错的。
JDK=1.6
target=android-15
解决方法
在gradle配置文件加入:
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'
}
}
在运行一次APP即可以成功编译。

APP build.gradle 配置文件内容为:
apply plugin: 'android'
android {
compileSdkVersion 15
buildToolsVersion "20.0.0" defaultConfig {
applicationId "net.oschina.app"
minSdkVersion 9
targetSdkVersion 19
} buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.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'
}
}
} dependencies {
compile files('libs/Android_SDK_v1.2_Fix.jar')
compile files('libs/commons-httpclient-3.1.jar')
compile files('libs/core-2.3.0.jar')
compile files('libs/httpmime-4.1.3.jar')
compile files('libs/libammsdk.jar')
}
duplicate files during packaging of apk的更多相关文章
- AndroidStudio使用第三方jar包报错(Error: duplicate files during packaging of APK)
http://www.kwstu.com/ArticleView/android_201410252131196692 错误描述: Error: duplicate files during pack ...
- com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK assets/com.xx.xx
完整的Error 信息(关键部分) Error:Execution failed for task ':fanwe_o2o_47_mgxz_dingzhi:transformResourcesWith ...
- com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE
在将vivo eclipse sdk 迁移 android studio 时候报错 Error:Execution failed for task ':vivosdk:transformResour ...
- 解决DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE(或META-INF/DEPENDENCIES)
导入eclipse项目时报 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.> ...
- 错误:com.android.builder.packaging.DuplicateFileException: Duplicate files copied
File2: C:\Users\guoxw\.gradle\caches\modules-2\files-2.1\org.jsoup\jsoup\1.10.3\b842f960942503cf1abb ...
- Android Duplicate files copied in APK
今天调试 Android 应用遇到这么个问题: Duplicate files copied in APK META-INF/DEPENDENCIES File 1: httpmime-4.3.2.j ...
- Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt
1 .Duplicate files copied in APK META-INF/LICENSE.txt android { packagingOptions { exclude 'META-I ...
- Duplicate files copied in APK META-INF/LICENSE.txt
Error:Execution failed for task ':app:packageDebug'. > Duplicate files copied in APK META-INF/LIC ...
- Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt解决方案
My logcat: log Execution failed for task ':Prog:packageDebug'. Duplicate files copied in APK META-IN ...
随机推荐
- LoadTestAgentResultsLateException in VS2010
遇到报错, 首先得先仔细读读人家给的出错信息. 而不是先怀疑是自己什么地方弄错了, 胡乱修改. 比如说, 遇到下面的报错: LoadTestAgentResultsLateException R ...
- WF4.0(3)----变量与参数
已经写了两篇关于WF4.0的博客,算是基础博客,如果是WF比较熟悉就直接跳过吧,如果你对工作流不是很熟悉,或者想了解一下基础的东西,本文还是比较适合你的.工作流中变量,参数,表达式属于数据模型中概念, ...
- JavaScript的js文件压缩和格式化工具
JavaScriptcompressor.com这个网站可是大名鼎鼎啊.以前在找到过压缩 Javascript 代码的程序,一直在用,感觉效果不错.域名是: http://javascriptcomp ...
- IOS NSString 用法详解
[cpp] view plain copy //NSString 操作均不改变自身值 //构建字符串 NSString *szTmp = @"A string"; ...
- C# AES加密解密
完整代码: /****************************************************************** * 创建人:HTL * 创建时间:2015-04-1 ...
- WebClient.DownloadData突然失灵
有如下的代码: try { byte[] acsMetadata; using (WebClient webClient = new WebClient()) { acsMetadata = we ...
- Hyper-V如何应用新的网卡
最近新装了块网卡,可是在Hyper-V的虚拟机设置里怎么也找不到如何应用这个新网卡. 把我郁闷坏了. 偶尔点点,才发现原来不是在虚拟机的设置里面,而是在上面的一级设置. 新建完后就可以在虚拟机的网 ...
- C#.NET常见问题(FAQ)-listView如何显示网格线
把GridLines设置为True 更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/acetaohai123 我的在线论坛: http:/ ...
- VM虚拟机如何和主机共享文件夹或文件
请一定要选中Map as a network drive in Windows guests,否则将无法查看共享.
- Java从零开始学二十(集合简介)
一.为什么需要集合框架 数组的长度是固定的,但是如果写程序时并不知道程序运行时会需要多少对象.或者需要更复杂的方式存储对象,---那么,可以使用JAVA集合框架,来解决这类问题 二.集合框架主要接口 ...