Which httpmime version can I use with Android's HttpClient?

后端 未结 2 944
慢半拍i
慢半拍i 2021-01-20 10:51

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

I don\'t wan

相关标签:
2条回答
  • 2021-01-20 11:12
    dependencies {
        compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5'
        compile 'org.apache.httpcomponents:httpmime:4.3.5'
    }
    
    0 讨论(0)
  • 2021-01-20 11:27

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

    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>
    
    0 讨论(0)
提交回复
热议问题