我可以用Android的HttpClient的使用哪个版本httpmime? [英] Which httpmime version can I use with Android's HttpClient?

查看:600
本文介绍了我可以用Android的HttpClient的使用哪个版本httpmime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Android的HttpClient的上传文件。不幸的是, Android不包括MultipartEntity 的,所以我必须使用 Apache的httpmime库

I need to upload files using Android's HttpClient. Unfortunately, Android doesn't include MultipartEntity, so I must using Apache's httpmime library.

我不希望承担的Andr​​oid的HttpClient的和官方的H​​ttpClient可能发生的冲突。另外,我不希望在更多的外部库带来比我有,因为我需要让我的方法算低的。

I don't want to incur possible conflicts between the Android's HttpClient and the official HttpClient. Also, I don't want to bring in more outside libraries than I have to because I need to keep my method count low.

将与Android的HttpClient的工作是什么版本httpmime的? 所有我已经看到了问题的推荐httpmime 也建议使用 Apache的官方的HttpClient或的HttpCore

What version of httpmime will work with Android's HttpClient? All of the questions I've seen recommending httpmime also recommend using Apache's official HttpClient or HttpCore.

(我知道我应该使用改造,但我必须使用Android的HttpClient的与其他兼容的库。)

(I know I should use Retrofit, but I must use Android's HttpClient for compatibility with other libraries.)

推荐答案

<一个href=\"http://search.maven.org/#artifactdetails%7Corg.apache.httpcomponents%7Chttpmime%7C4.2.6%7Cjar\"><$c$c>httpmime-4.2.6.jar精细的工作全部由自己。我不需要其他依赖除此之外罐子。

httpmime-4.2.6.jar worked fine all by itself. I needed no other dependencies besides that jar.

如果您使用的是依赖性的管理构建系统如的Maven gradle这个,你会发现, <一href=\"http://grep$c$c.com/snapshot/repo1.maven.org/maven2/org.apache.httpcomponents/httpmime/4.2.6/\"><$c$c>httpmime-4.2.6取决于的HttpCore-4.2.5 。 Android的HttpClient的似乎与的HttpCore-4.2.5 兼容,所以我只是排除这种依赖。我的实际依赖声明如下:

If you're using a dependency-managing build system like Maven or gradle, you'll notice that httpmime-4.2.6 depends on httpcore-4.2.5. Android's HttpClient seems compatible with httpcore-4.2.5, so I just excluded that dependency. My actual dependency declaration is below:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpmime</artifactId>
    <version>4.2.6</version>
    <exclusions>
        <exclusion>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </exclusion>
    </exclusions>
</dependency>

这篇关于我可以用Android的HttpClient的使用哪个版本httpmime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆