1
I can’t import class from org.apache.http.conn
on my Eclipse app.
This is my class:
package br.com.cadastro.cadastrocompleto.suporte;
import java.io.IOException;
public class WebClient {
private String url;
public WebClient(String url){
this.url = url;
}
public void post(String json){
try {
HttpPost post = new HttpPost(url);
post.setEntity(new StringEntity(json));
post.setHeader("Accept", "application/json");
post.setHeader("Content-type", "application/json");
HttpClient httpClient = new HttpClient();
HttpResponse response = httpClient.execute(post);
String jsonDeResposta = EntityUtils.toString(response.getEntity());
}catch(IOException e){
e.printStackTrace();
}
}
}
What can I do about it?
EDIT
It looks like this in the Eclipse:
How do you import the library?
– Thiago Luiz Domacoski
I’ll send you a print of what’s going on so you can understand better. I click on the red to import and Eclipse cannot resolve type Httppost http://imgur.com/vmxm9N0
– Felipe De Aquino Nascimento
Exactly! He belongs to a library . should be downloaded and added to the project! Follow how to do
– Thiago Luiz Domacoski
I downloaded httpcomponents-client-android-4.3.5.1 from the Apache Foundation website but cannot find a jar file with the library
– Felipe De Aquino Nascimento
it is a zip? send the link you downloaded! so it is easier
– Thiago Luiz Domacoski
@Brunocésar worked right here. I was downloading src, and then I downloaded the file . bin and came the files .jar. Thanks.
– Felipe De Aquino Nascimento
@Felipedeaquinonascimento ok, includes an answer to not only leave in comment
– Bruno César