Apache HttpClient Android(Gradle)
我已经将此行添加到我的build.gradle
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
我想在代码中使用MultipartEntityBuilder。 但是,Android Studio不会将库添加到我的代码中。谁能帮我这个?
8个解决方案
127 votes
如果您使用目标sdk作为23,请在build.gradle中添加以下代码
android{
useLibrary 'org.apache.http.legacy'
}
这里的附加说明:不要尝试使用这些文件的gradle版本。 他们坏了(28.08.15)。 我尝试了5个小时以上才能使其正常工作。 它只是没有。不起作用:
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
另一件事不要使用:
'org.apache.httpcomponents:httpclient-android:4.3.5.1'
其参考21 API级别。
Jinu answered 2020-01-10T22:24:48Z
24 votes
接受的答案对我来说似乎不太正确。 当可以依赖同一版本的HttpMime时,毫无意义地拖动它。
compile group