Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import cannot be resolved even after adding to build path and cleaning

I'm having a rough time getting the Apache HttpClient jar libraries imported in the Eclipse ADT. I downloaded the jars. I added them to the project internally and to my build path, and cleaned the project. I kept getting the "import org.apache.commons.httpclient cannot be resolved" message. I tried adding them as an external jar, cleaning the project again, and closing and reopening Eclipse for good measure. No luck. It still has no idea that the jars are there. I feel like there's something basic I'm not doing, but I can't figure out what it is. It seems that most of the time that someone has a problem like this, what fixes it is doing one of the things that I've already done and hasn't worked.

screenshot

like image 637
Displaced Hoser Avatar asked Jan 25 '26 22:01

Displaced Hoser


2 Answers

Maybe it should be org.apache.http.client.HttpClient - HttpClient which is packaged with Android.

like image 129
tenorsax Avatar answered Jan 27 '26 12:01

tenorsax


Check that the jar contains the exact class at the specified package. You can expand the referenced libraries node to do this.

Also it's likely it should be:

import org.apache.http.client.HttpClient;

import org.apache.http.client.methods.HttpPost;

like image 42
Alb Avatar answered Jan 27 '26 11:01

Alb