Error using the apache class HttpClient

5

I'm trying to develop an app in which it will communicate with webservice, but at the time having to use the HttpClient or other classes related to the apache library gives error as it does not exist, I already manually put the .jar files in the lib folder but it continued to present the error.

    
asked by anonymous 29.10.2015 / 17:41

2 answers

3

Next friend add the following libraries to build.gradle in block dependencies .

dependencies {
    ...
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    
04.04.2016 / 14:05
4

In the Android 6.0 version (API level 23) support for the HTTP HTTP Apache client was removed.

Instead use the class HttpURLConnection . This API is more efficient as it reduces network usage and minimizes power consumption.

To continue using the Apache HTTP APIs, you have to declare the following dependency in the build.gradle file:

android {
    useLibrary 'org.apache.http.legacy'
}

Information Obtained here

    
29.10.2015 / 17:56