HttpClient cannot be allowed for type

I am trying to make http request in android

but i got these errors

- HttpClient cannot be resolved to a type

- DefaultHttpClient cannot be resolved to a type

screenshot:

enter image description here

+5
source share
3 answers

Delete this line:

 import org.apache.http.*; 

And add the following:

 import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; 
+3
source

This solved the problem for me: click on the project folder, then press Alt + Enter, go to Java Build Path, Libraries, click on add external Jar, add the .jar file located on "sdk \ platform \ android-23 \ optional \ org .apache.http.legacy.jar ", go to order and export mode and click on org.apache.http.legacy.jar, click OK and it will be allowed.

+3
source

perform the following procedure:

Copy Jar -> paste the Jar in Libs folder in Project -> right-click on jar -> Buildpath -> add to build path.

0
source

All Articles