HttpResponse cannot be resolved - android

In my previous project i used AsyncHttpClient and lib was android-async-http-1.4.8.jar and everything was fine.But now when i am importing that Project in different eclipse environment it is showing.. The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required .class files this error.
Anyone kindly help me with this...???
I have gone through Missing dependency for HttpClient but didnt get anything.

I resolved this problem with the help of httpcore 4.4.1.jar file.
I added this jar file to my lib folder and then added to build path and cleaned the project. It is working fine now..
Thanks to all of you for your valuable contribution.

Right Click on Project, GO to Build Path and Make sure that asynchttpclient.jar is marked. And Then Clean Project. It Should Work.

Probably you are missing android-async-http-1.4.8.jar
Follow instructions for importing the third-party library, then adding it using Build Path (which makes it known to Eclipse for compilation purposes). Here is the step-by-step:
Right-click libs folder in your project and choose Import -> General -> File System, then Next, Browse in the filesystem to find the library's parent directory (i.e.: where you downloaded it to).
Click OK, then click the directory name (not the checkbox) in the left pane, then check the relevant JAR in the right pane. This puts the library into your project (physically).
Right-click on your project, choose Build Path -> Configure Build Path, then click the Libraries tab, then Add JARs..., navigate to your new JAR in the libs directory and add it.
I hope it helps!

I encountered the same problem with you, do not use the Android6.0 framework,and I try this instead Android5.0, the problem is solved,hope this answer is not too late.

For API23 I downgrade to android-async-http-1.4.4.jar and import org.apache.http.legacy.jar to avoid error with the deprecated Header class. For me works fine.

Related

Type The container 'Android Dependencies' references non existing library android-support-v7-appcompat/bin/android-support-v7-appcompat.jar

I just got some kind of error when trying to using Action Bar Compat support library to my project, I don't know what's wrong, because I have followed the instructions from this link > http://developer.android.com/tools/support-library/setup.html
So, this is the screen shot of the error ..
I also encountered such problem. My error was:
The container 'Android Dependencies' references non existing library 'C:\development\adt-bundle-windows-x86-20140702\workspace\appcompat_v7\bin\appcompat_v7.jar'
To solve this, I went project>properties>java build path>libraries>add jars>appcompat_v7>libs>, then I selected android-support-v7-appcompat.jar. After this, I went to project>clean. This fixed the problem. Hope you find my hint helpful.
As in the instructions you mentioned, please make sure to follow this step to add .jar files instead of directly go to Properties > Java Build Path > Libraries to add them.
In the new library project, expand the libs/ folder, right-click each
.jar file and select Build Path > Add to Build Path. For example, when
creating the the v7 appcompat project, add both the
android-support-v4.jar and android-support-v7-appcompat.jar files to
the build path.
I just had this issue, when creating a new project. After following the instructions from the link you provided, close your project, then close Eclipse, restart Eclipse, open your project then clean and build your project. This did the trick for me.
These days I used the latest android support library 21 and got the same issue.
I followed the answer of #dazilli,but do not work.
Just now,I updated the JDK from 6 to 7,then it solved the problem.
First of all cleanup a library project and build project check library project has bin files after that clean your project its work for me
andriod platform must be android 5.0 and set 'target=21'
make sure download Extras
In my case the files were in appcombat_v7/lib folder, so what i did is right-click the .jar files (there will be two files select android-support-v4.jar) and then select Build Path>Add to Build Path. What it does is that it adds this file to the Build Path (i.e it will add this file to the "bin folder") which will solve the problem.

Unable to import libraries to eclipse

When I try to use libraries they all seem empty to me (when I try to import them I can only see 'empty' packages). I tried both: drag-drop libraries to \libs and importing them. I don't know what is causing this problem...
I'm trying to import androidplot libraries, I'm not finding this particular issue on their boards so maybe I'm doing something wrong?!
EDIT
You're importing the androidplot sources jar which wont work because its full of .java files instead of the expected .class files. Use the library jar instead.
You should put them in your "libs" folder below, among with the others such as "android-support-v4", not with the Android the dependencies.
depending on the ADT version that you use, you may want to start reading here
Note that lib usages is no longer simple process of copying jars to a folder and building. The library project may need to be in eclipse and build as 'library' then referred to as a dependency in the specific idiom mentioned above in link.
Follow the below steps .this might help you:
1-> Right Click on Your Project
2-> Click on Build Path
3-> Select Configure Build Path
4-> Select Add External JAR
5-> Locate Jar file in your System and add

Referencing Android Library Project Error

I am having issues getting my project that references an Android Library to compile. I have exactly followed the instructions in the documentation here: http://developer.android.com/tools/projects/projects-eclipse.html
My android library is is marked as a library correctly, and I can see the jar file and all my .class files in my project. But the classes are not found when I try to reference them in my new project and it will not compile. What am I doing wrong?
Here is a screenshot (SoundGraphingLibrary is my library project and SoundGraphingLibrary is the project I need to use the library in):
Make sure that the project and the library project are in the same folder..
First, run Project->Clean on the library, then your project as #iagreen suggests. Then go ahead and close and reopen eclipse. Wait for everything to build.
Assuming nothing is better at this point, click on the library and do Project->Properties->Android. Confirm that Is Library is checked. Now, delete any instance of the library *.jar in your project. Do Project->Properties->Android on your project. Click Add... and click on the library you want, OK, Apply, OK.
That should do it. Also, fire lemurs.
Not sure if this helps but i did the following
Remove and adding the library by going to Project->Properties->Android.
Clear the project by going to Project->Clean
Restart Eclipse and tata it works.

How do you cause com.actionbarsherlock to be in the gen folder of an Android project?

I'm trying to build and run the demos included with ActionBarSherlock. I go to File -> New Android project from existing source, and navigate to the samples/demos directory. The project is imported into eclipse, however, none of the R. references are resolved, because com.actionbarsherlock doesn't appear in the gen folder.
The actionbarsherlock library is being referenced (Properties -> Android -> Libraries). actionbarsherlock.jar is in the Android Dependencies folder.
Thanks for the help.
EDIT: Just referencing the library in another eclipse project causes com.actionbarsherlock to be properly generated. I have no idea why the same behavior in this demos project isn't generating com.actionbarsherlock.R.
EDIT 2: And now it has magically decided to work. I did nothing special, just continually referenced and un-referenced the library until it worked.
Thanks for looking all, the problem's been solved
the gen folder (and R.java) are generated during compilation. Try doing a clean and build to see if R and gen/ get created.
If they don't, then compilation is failing. If there are any errors in eclipse that are not related to missing R.java, fix them or post them as a comment for more info.
This might be a problem with the import my.project.R statements at the top of each java file, but checking the errors will confirm or deny this.
I don't think the gen folder is created until you try to run the app.
If this isn't the issue, you could try fixing the project properties. Right click on the project --> Android Tools --> Fix Project Properties

Why can't android find com.google.gson.Gson

I'm trying to use GSON in my project, but my application is crashing, with logcat saying that com.google.gson.Gson cannot be found. I've put import com.google.gson.Gson on my class files, I have gson in my package explorer, and added it by Right click -> build path -> add libraries. It also shows up in Project->properties->java build path->libraries tab->gson. What have I done wrong?
What worked for me: Check the checkbox next to the lib (gson-2.0.jar) in: 'Project Properties' -> 'Java Build Path' -> 'Order and Export' tab. Then do a clean/build.
This adds the exported=true attribute to the classpath entry
<classpathentry exported="true" kind="lib" path="libs/gson-2.0.jar"/>
Have you put the jar file in the libs folder of the project? If not , try moving it there, creating the folder if required. Should be at the same level as the src folder.
I had a similar issue trying to get an app built and that solved it.
I'm using IntelliJ, not eclipse but here is how I did it:
Download the source files from https://google-gson.googlecode.com/files/google-gson-2.2.4-release.zip
Unpack them
Copy them into the "libs" folder of your project. I did this manually by using the terminal but you can do it by going in your project folder located in your computer. Your Project_Name >app >Libs [paste them here]
Go to your editor (IntelliJ in my case) You should see the the following 3 files in the libs folder of the project structure:
gson-2.2.4.jar
gson-2.2.4-javadoc.jar
gson-2.2.4-sources.jar
Open your build.gradle file and insert the following line in the dependencies section:
compile files('libs/gson-2.2.4.jar', 'libs/gson-2.2.4-javadoc.jar', 'libs/gson-2.2.4-javadoc.jar')
Right click on each of the source files and select "Add as Library..."
Use the following options:
Name: name of the jar file
Level: Project Library
Add to Module: select project your adding to
Rebuild project
Build > Rebuild project
Import and use it!
import com.google.gson.Gson;
I have observed today that it doesn't like when you add your library.
The solution that worked for me was to add it as an external jar only. I have observed it by doing the steps described by author of this post i.e. Properties -> Java Build Path -> Libraries -> Add External JARs and point to the downloaded gson library.
I ran into the same issue (when installed SDK 17) ...
The solution is, that you just put the pure jar files into the "libs" folder (without subfolders).
You also don't need to declare them, android wil find them itself. You may need to do a Project > Clean
I had similar problem, but I guess my requirement was more complicated as the GSON libarary was used by an Android Library Project that my main Android project depended on. I have tried both approaches above but none of them worked for me. If I add the GSON jar file directly to the main Android project it works, but that is not what I wanted.
With a bit of investigation I have realised that the GSON jar does not use any dependencies (third party libraries) itself. So my solution was to copy the source file of the GSON project to my Android Library project's src filder and it worked like a charm. so you can use the Source code rather then the binary code. The source code is part of the download in a jar file, just unzip it.
i'm sure you have copied the jar into "libs",
and also added property> Java Build Path >(tab) Libraries, right?
my issue was stupid...
please check other than Gson jar, if you have two stuffs at least in above tab:
android x.x
Android Dependencies (especially this one, i missed this, eclipse show me an error of "could not find class com.google.gson.xx" )
simply do a project copy will solve this problem...
Do not edit .classpath file directly or even put files into lib folders out of Eclipse.
Instead use the Java Build Path->Order and Export tab to select libraries to be exported in the final deployment unit (eg war/apk)
To be on safer side, do a Project->Clean after you change the build path.
I faced the same thing.But the solution was quite easy,just Right-Click on your project->Properies->Libraries->Add external jars->OK and thats it.It solved my problem.hope it will solve yours as well
If Projct Properties -> Java build path -> Add external jars doesn't work and your project is a web project, try adding the gson jar directly to the server lib folder. Example: for apache Tomcat to apache-tomcat/lib.
I have been trying the same thing and read so many answers and tried so many things but to not vial, but i solved this problem by doing just one click and its simple.
1) Add your .jar file in libs folder make sure its libs not lib
2) Clean and Build your project you will see that file under libs folder
3) right click the file and go to build path and select add to build path
Run your project it will work fine. Hope this helps
I am using Android Studio
I had the same problem I had solve it by
select project press f4 from popup
click app and in dependencies
select file dependency and select the three folders which I had pasted in lib directory

Categories

Resources