HttpClientBuilder missing on Android?

Apache has abandoned DefaultHttpClient, but this does not seem to apply to Android, see also here Deprecated Java HttpClient - how complicated is it?

Import

org.apache.httpcomponents:httpclient:4.3.5

instead

new DefaultHttpClient(); 

Now i would use

HttpClient httpClient = HttpClientBuilder.create().build();

to create an http client. This works well in a Java project, but when used in an Android project, the following import is missing.

import org.apache.http.impl.client.HttpClientBuilder;

and

HttpClient sendClient =  new DefaultHttpClient();

not marked as deprecated on Android and compiles fine.

I don't want to add Apache httpclient a second time (and if I did this, Android Studio would exclude it anyway).

The Android documentation says http://developer.android.com/reference/android/net/http/AndroidHttpClient.html#newInstance(java.lang.String) to use

AndroidHttpClient.new Instance(string)

" http- ".

- , HttpClient Android, userAgent!?

+4
2

Google Android ( BETA) Apache HttpClient 4.0.

API- Apache HttpClient Android, .

+6

Gradle

compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
+3

Source: https://habr.com/ru/post/1569662/


All Articles