xrd*_*xrd 38 android gradle apache-httpclient-4.x
当我尝试运行"gradle build"时,我看到了这个错误
WARNING: Dependency org.apache.httpcomponents:httpclient:4.2.3 is ignored for the default configuration as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
:prepareFreeDebugDependencies
:compileFreeDebugAidl UP-TO-DATE
:generateFreeDebugBuildConfig UP-TO-DATE
:mergeFreeDebugAssets UP-TO-DATE
:compileFreeDebugRenderscript UP-TO-DATE
:mergeFreeDebugResources UP-TO-DATE
:processFreeDebugManifest UP-TO-DATE
:processFreeDebugResources UP-TO-DATE
:compileFreeDebug
/home/xrdawson/Projects/Foo/Bar/src/main/java/com/Foo/app/PixActivity.java:20: error: package org.apache.http.entity.mime does not exist
import org.apache.http.entity.mime.HttpMultipartMode;
^
Run Code Online (Sandbox Code Playgroud)
build.gradle的结尾如下所示:
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile "org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.3"
compile "com.madgag:markdownj-core:0.4.1"
// compile "org.apache.httpcomponents:com.springsource.org.apache.httpcomponents.httpclient:4.2.1"
compile 'org.apache.httpcomponents:httpclient:4.2.3'
compile "com.google.android:support-v4:r6"
}
}
Run Code Online (Sandbox Code Playgroud)
为什么编译过程会忽略HttpClient,但是无法编译?
Hie*_*mus 79
我认为httpclient库不包含mime部分,它们都在httpmime中.这是httpclient的传递依赖,但由于忽略了它,因此不会将其考虑在内.
尝试添加此依赖项:
compile "org.apache.httpcomponents:httpmime:4.2.3"
Run Code Online (Sandbox Code Playgroud)
twe*_*e17 17
http-mime作为依赖项添加会导致httpclient作为传递依赖项包含在内,对我来说,它会产生与OP相同的警告.我不得不告诉gradle忽略传递依赖:
compile ('org.apache.httpcomponents:httpmime:4.3.5') {
// avoid "is ignored for the default configuration X" warnings
// since httpclient is included in the android SDK.
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
Run Code Online (Sandbox Code Playgroud)
Mar*_*era 13
对于Android,现在有可用的HttpClient 4.3.X重新打包的Maven发行版
项目回购:https://github.com/smarek/httpclient-android
Maven标签:cz.msebera.android:httpclient:4.3.+
发布到Maven Central存储库
在4.3.3版本中包括HttpCore,HttpClient,HttpClient-Cache和HttpMime(所有版本相同)
免责声明:我是该项目的作者
| 归档时间: |
|
| 查看次数: |
65321 次 |
| 最近记录: |