转:AndroidStudio导入httpmime jar编译不通过的解决办法
2015-11-25 01:11
639 查看
packagingOptions 应该放到最前面才生效,放到最后面经试验不行。
原作者地址:http://blog.csdn.net/u010257920/article/details/44055627
本人项目的build.gradle
apply plugin: ‘com.android.application’
apply plugin: ‘android-apt’
def A***ersion = ‘3.3.2’
android {
}
dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
}
apt {
}
=======================================
起因:
build.gradle的dependencies加入了
compile ‘org.apache.httpcomponents:httpcore:4.3.3’
compile ‘org.apache.httpcomponents:httpmime:4.3.6’
Err现象:
在构建时出现以下错误log
[html] view plaincopy
Information:Gradle tasks [:imagecloud:assembleDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:imagecloud:preBuild
:imagecloud:compileDebugNdk UP-TO-DATE
:imagecloud:preDebugBuild
:imagecloud:checkDebugManifest
:imagecloud:preReleaseBuild
:imagecloud:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:imagecloud:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:imagecloud:prepareDebugDependencies
:imagecloud:compileDebugAidl UP-TO-DATE
:imagecloud:compileDebugRenderscript UP-TO-DATE
:imagecloud:generateDebugBuildConfig UP-TO-DATE
:imagecloud:generateDebugAssets UP-TO-DATE
:imagecloud:mergeDebugAssets UP-TO-DATE
:imagecloud:generateDebugResValues UP-TO-DATE
:imagecloud:generateDebugResources UP-TO-DATE
:imagecloud:mergeDebugResources UP-TO-DATE
:imagecloud:processDebugManifest UP-TO-DATE
:imagecloud:processDebugResources UP-TO-DATE
:imagecloud:generateDebugSources UP-TO-DATE
:imagecloud:compileDebugJava UP-TO-DATE
:imagecloud:preDexDebug UP-TO-DATE
:imagecloud:dexDebug UP-TO-DATE
:imagecloud:processDebugJavaRes UP-TO-DATE
:imagecloud:validateDebugSigning
:imagecloud:packageDebug
Error:duplicate files during packaging of APK E:\workspace\project\android\AndroidStudio\imagecloud\build\outputs\apk\imagecloud-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b66447f7ec\httpmime-4.3.6.jar
Origin 2: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.3.3\f91b7a4aadc5cf486df6e4634748d7dd7a73f06d\httpcore-4.3.3.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude ‘META-INF/DEPENDENCIES’
}
}
Error:Execution failed for task ‘:imagecloud:packageDebug’.
Duplicate files copied in APK META-INF/DEPENDENCIES
File 1: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b66447f7ec\httpmime-4.3.6.jar
File 2: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b66447f7ec\httpmime-4.3.6.jar
Information:BUILD FAILED
Information:Total time: 4.954 secs
Information:2 errors
Information:2 warnings
Information:See complete output in console
解决方法:
在build.gradle的android{…}里面加上
[html] view plaincopy
packagingOptions {
exclude ‘META-INF/DEPENDENCIES’
exclude ‘META-INF/NOTICE’
exclude ‘META-INF/LICENSE’
exclude ‘META-INF/LICENSE.txt’
exclude ‘META-INF/NOTICE.txt’
}
原作者地址:http://blog.csdn.net/u010257920/article/details/44055627
本人项目的build.gradle
apply plugin: ‘com.android.application’
apply plugin: ‘android-apt’
def A***ersion = ‘3.3.2’
android {
[code]packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } useLibrary 'org.apache.http.legacy' compileSdkVersion 23 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.turing.base" minSdkVersion 10 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
}
dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
[code]apt "org.androidannotations:androidannotations:$A***ersion" compile "org.androidannotations:androidannotations-api:$A***ersion" compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.apkfuns.logutils:library:1.0.6' compile 'com.android.support:design:23.0.1' // 使用HttpClient传递文件需要添加的依赖 compile 'org.apache.httpcomponents:httpcore:4.3.3' compile 'org.apache.httpcomponents:httpmime:4.3.6'
}
apt {
[code]arguments { androidManifestFile variant.outputs[0].processResources.manifestFile resourcePackageName 'com.turing.base' // 工程包名 }
}
=======================================
起因:
build.gradle的dependencies加入了
compile ‘org.apache.httpcomponents:httpcore:4.3.3’
compile ‘org.apache.httpcomponents:httpmime:4.3.6’
Err现象:
在构建时出现以下错误log
[html] view plaincopy
Information:Gradle tasks [:imagecloud:assembleDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:imagecloud:preBuild
:imagecloud:compileDebugNdk UP-TO-DATE
:imagecloud:preDebugBuild
:imagecloud:checkDebugManifest
:imagecloud:preReleaseBuild
:imagecloud:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:imagecloud:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:imagecloud:prepareDebugDependencies
:imagecloud:compileDebugAidl UP-TO-DATE
:imagecloud:compileDebugRenderscript UP-TO-DATE
:imagecloud:generateDebugBuildConfig UP-TO-DATE
:imagecloud:generateDebugAssets UP-TO-DATE
:imagecloud:mergeDebugAssets UP-TO-DATE
:imagecloud:generateDebugResValues UP-TO-DATE
:imagecloud:generateDebugResources UP-TO-DATE
:imagecloud:mergeDebugResources UP-TO-DATE
:imagecloud:processDebugManifest UP-TO-DATE
:imagecloud:processDebugResources UP-TO-DATE
:imagecloud:generateDebugSources UP-TO-DATE
:imagecloud:compileDebugJava UP-TO-DATE
:imagecloud:preDexDebug UP-TO-DATE
:imagecloud:dexDebug UP-TO-DATE
:imagecloud:processDebugJavaRes UP-TO-DATE
:imagecloud:validateDebugSigning
:imagecloud:packageDebug
Error:duplicate files during packaging of APK E:\workspace\project\android\AndroidStudio\imagecloud\build\outputs\apk\imagecloud-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b66447f7ec\httpmime-4.3.6.jar
Origin 2: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.3.3\f91b7a4aadc5cf486df6e4634748d7dd7a73f06d\httpcore-4.3.3.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude ‘META-INF/DEPENDENCIES’
}
}
Error:Execution failed for task ‘:imagecloud:packageDebug’.
Duplicate files copied in APK META-INF/DEPENDENCIES
File 1: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b66447f7ec\httpmime-4.3.6.jar
File 2: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b66447f7ec\httpmime-4.3.6.jar
Information:BUILD FAILED
Information:Total time: 4.954 secs
Information:2 errors
Information:2 warnings
Information:See complete output in console
解决方法:
在build.gradle的android{…}里面加上
[html] view plaincopy
packagingOptions {
exclude ‘META-INF/DEPENDENCIES’
exclude ‘META-INF/NOTICE’
exclude ‘META-INF/LICENSE’
exclude ‘META-INF/LICENSE.txt’
exclude ‘META-INF/NOTICE.txt’
}
相关文章推荐
- YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. </HTML>/ 标签: yum 2014-05-26
- tcpdump命令使用方法
- llinux 定时器 转载自 http://blog.chinaunix.net/uid-11848011-id-96374.html
- python-15:HTTPError 错误码大全
- ios 实时监测网络状况
- 1、下载安装scala编译器(可以理解为scala的jdk),地址:http://www.scala
- 网络众包能否颠覆传统软件开发?
- Linux 网络select模型
- Linux网络poll模型
- 入门网络安全第一天
- http://macrochen.iteye.com/blog/1414568
- [连载]《C#通讯(串口和网络)框架的设计与实现》-3.设备驱动的设计
- Webpack 转自http://segmentfault.com/a/1190000002551952
- Vue.js 转自http://zhuanlan.zhihu.com/evanyou/20302927
- sudo tcp_wrappe
- Github: 团队账号:https://github.com/ChenRuTing
- 各大网络请求框架的比较
- iOS_NSURLSessionDownloadTask_显示加载进度_断点续传(网络中断情况).
- 如何用 fiddler 捕获 https 请求
- Tcp 断开连接(重要)