Aleksey Timoshchenko Aleksey Timoshchenko - 1 year ago 78
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

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 Source

In your Gradle file, just add the dependency:

apply plugin: ''

android {
    useLibrary  'org.apache.http.legacy'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download