android studio 没有自带 httpClinet类库吗?要怎么导入
android studio 没有自带 httpClinet类库吗?要怎么导入
android studio 没有自带 httpClinet类库吗?要怎么导入
2015-10-23
Error:duplicate files during packaging of APK E:\Android\AndroidStudioProjects\Http_01\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: E:\Android\AndroidStudioProjects\Http_01\app\libs\httpclient-4.5.1.jar
Origin 2: E:\Android\AndroidStudioProjects\Http_01\app\libs\httpcore-4.4.3.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/DEPENDENCIES
File 1: E:\Android\AndroidStudioProjects\Http_01\app\libs\httpclient-4.5.1.jar
File 2: E:\Android\AndroidStudioProjects\Http_01\app\libs\httpcore-4.4.3.jar
Information:BUILD FAILED
运用以上运行还是出现问题请帮我?
Apache HttpClient 4.0开始Android就没集成,可以参考HttpClient的说明:
http://hc.apache.org/httpcomponents-client-4.3.x/android-port.html
As Apache HttpClient 4.0 was maturing the project was expecting Google to incorporate the latest code improvements into their code tree. Unfortunately it did not happen.
HttpClient不需要另外下载,只需要在你对应的module中加入HttpClient的Library Dependencies,build.gradle会自动下载对应的HttpClient库,或者你也直接在build.gradle中加。
project structure->modules->dependencies->添加Library dependencies
build.gradle加:
dependencies {
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}
举报