Aleksey Timoshchenko Aleksey Timoshchenko - 19 days ago 5
Android Question

How to connect org.apache.http to my project?

I use Android and found such official tutorial and link how to download this lib to the project

http://hc.apache.org/httpcomponents-client-4.3.x/android-port.html

but after I have added this line to gradle I still can't use http classes...

I tried to import them to my class but anyway they don't work and marked as

Cannot resolve symbol
...

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;


What am I doing wrong?

Answer

In your Gradle file, just add the dependency:

apply plugin: 'com.android.application'

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