I'm using Eclipse IDE Mars and the ADT android plugin and the sdk 23; I'm trying to call a REST web services from an Android application, I'm following this tutorial tutorial-how-to-call-restful-webservice-in-android-part , after I create a class that create this instances
RequestParams params = new RequestParams();
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://192.168.2.2:9999/useraccount/login/dologin",params ,new AsyncHttpResponseHandler() {
I need to do this imports from the library:
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
I get the following errors
1) The project was not built since its build path is incomplete. Cannot find the class file for cz.msebera.android.httpclient.HttpResponse. Fix the build path then try building this project
2) The type cz.msebera.android.httpclient.HttpResponse cannot be resolved. It is indirectly referenced from required .class files LoginActivity.java /CallAre/src/com/example/callare line 1 Java Problem
I added the library following this instrucctions in the tutorial
Step 2: Add library to project
Add below third party library into project’s ‘lib’ folder. You can also download it if you don’t have it with you.
I added the library by right clicking the "libs" folder in my project then selecting import and then I choose the jar from the location I Downloaded it.
When I go to my Java build Path the library is in the tab Libraries in here there are 3 categories:
Android 6.0
Android Dependencies
Android Private Libraries
---android-async-http-1.4.9.jar <-- this is my library
I tried clicking the library in my project and choose add to build path after I did this I checked the Java Build Path again and my library was inside the folder Android 6.0 like this
Android 6.0
---android-async-http-1.4.9.jar <-- this is my library
Android Dependencies
Android Private Libraries
---android-async-http-1.4.9.jar <-- this is my library
But when I check the package explorer my library wasn't in the android 6.0 folder, it was in a new created folder called Referenced Libraries.
I checked a few questions and videos about how to add a library in eclipse in an Android project and the method was the same that i followed to added it.
EDIT 1:
I added this jar httpclient-4.4.1.1.jar from this maven repo https://repo1.maven.org/maven2/cz/msebera/android/httpclient/ and now I have the following problems:
1) The method onFailure(int, Throwable, String) of type new AsyncHttpResponseHandler(){} must override or implement a supertype method
2) The method onSuccess(String) of type new AsyncHttpResponseHandler(){} must override or implement a supertype method
3) The type new AsyncHttpResponseHandler(){} must implement the inherited abstract method AsyncHttpResponseHandler.onFailure(int, Header[], byte[], Throwable)
4) The type new AsyncHttpResponseHandler(){} must implement the inherited abstract method AsyncHttpResponseHandler.onSuccess(int, Header[], byte[])
I don't know if I still have to add more jars because I'm not using Maven, I would like to know how can I add a dependency from the main library I wanted to install in firts place this one android-async-http.JAR that I downloaded from this page http://loopj.com/android-async-http/ and let maven install the necesary jars, I'm using Eclipse IDE Mars,
How can I do this? 1) I can't seem to find the dependency so far the website just say this
Installation & Basic Usage
Add maven dependency using Gradle buildscript in format
dependencies {
compile 'com.loopj.android:android-async-http:1.4.9'
}
2) Do I need to install M2Eclipse plugin? 3) I already have a Android application project created in eclipse, if I install this plugin I would have to create a new project (it would'nt be a problem because I was doing just a tutorial)
you must download this jar cz.msebera.android and then import to your project
if you using android studio just using compile 'cz.msebera.android:httpclient:4.3.6' in your .gradle depedencies
hope it help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With