-3

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?

Sirop4ik
  • 4,543
  • 2
  • 54
  • 121

1 Answers1

4

In your Gradle file, just add the dependency:

apply plugin: 'com.android.application'

android {
    ...
    useLibrary  'org.apache.http.legacy'
    ...
}
Alessandro Argentieri
  • 2,901
  • 3
  • 32
  • 62