How to add android-async-http.jar to the eclipse Java build path

I am using eclipse ide Mars, ADT Android plug-in and SDK 23; I'm trying to call the rest web service from an Android application. After creating the class that creates the instance, I'm following this tutorial tutorial - how - to - Call - restful - WebService - in - Android - part

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 import from the Library:

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

I received the following error

1) The project was not built because the build path is incomplete. The class file for cz.msebera.android.httpclient.httpresponse cannot be found. Fix the build path and try to build the project

2) Cannot resolve cz.msebera.android.httpclient.httpresponse type. It is a Java problem indirectly referenced from line 1 of the required. Class file loginactivity.java/callare/src/com/example/callback

I added the library as described in this instruction

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. 

The library is added by right clicking the "LIBS" folder in the project, selecting "import", and then selecting jar from the download location

When I go to the Java build path, the library is located in the tab libraries, where there are three categories:

Android 6.0
Android Dependencies
Android Private Libraries 
   ---android-async-http-1.4.9.jar   <-- this is my library

I tried to click the library in the project, then select Add to build path, and then check the Java build path again. My library is located in such Android 6.0 folder

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

However, when I checked the package browser, my library was not in the Android 6.0 folder, but in a newly created folder called referenced libraries

I checked some questions and videos about how to add libraries in eclipse in Android project. This method is the same as that I followed when adding libraries

Edit 1:

I'm from this Maven repository https://repo1.maven.org/maven2/cz/msebera/android/httpclient/ After adding the jar httpclient-4.4.1.1.jar, I now encounter the following problems:

1) The onfailure (int, throwable, string) method of type new asynchttppresponsehandler() {} must override or implement a supertype method

2) Method onsuccess (string) of type new asynchttppresponsehandler() {} must override or implement a supertype method

3) The new type asynchttppresponsehandler() {} must implement the inherited abstract method asynchttppresponsehandler.onfailure (int, header [], byte [], throwable)

4) The new type asynchttppresponsehandler() {} must implement the inherited abstract method asynchttppresponsehandler.onsuccess (int, header [], byte [])

I don't know if I still want to add more jars because I don't use Maven. I want to know how to add dependencies from the first Android async HTTP main library I want to install. I'm from this page http://loopj.com/android-async-http/ Download and have Maven install the necessary jar. Jar. I'm using the eclipse ide,

How can I do this? 1) So far, I can't seem to find this dependency. The website just says so

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 the m2eclipse plug-in? 3) I have created an Android application project in eclipse. If I install this plug-in, I must create a new project (this won't be a problem, because I'm just doing a tutorial)

resolvent:

You must download this jar cz.msebera.android and import it into your project

If you are using Android studio and only use compile 'CZ. Msebera. Android: httpclient: 4.3.6' in the. Gradle permission

I hope it will help you

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>