org.apache包无法在Eclipse中解析

Fas*_*wan 9 java eclipse apache

下列

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
Run Code Online (Sandbox Code Playgroud)

无法解决.我下载了Apache Http软件包并通过外部jar选项导入它们,但它仍然无法解决.在Android中它似乎可以工作,在SDK中猜测它,但在这里我不是在做Android.我收到了错误的包裹吗?

我相信这是链接:

阿帕奇

pau*_*sm4 13

听起来 OK:

1) The .jar file in question should be something like "httpcore-4.0.1.jar". 
   Please confirm the name.

2) Adding this to "External Libraries" is absolutely the correct thing to do.

3) For compiling in the Eclipse IDE, you must:

   a) Select your project

   b) Select "Build Path" > "Add External Libraries"

4) For running in the Eclipse IDE, you must

   a) Select "Run" > "Run configurations".  
      Choose your (Java Application?) configuration.

   b) Select "Classpath" > "Add External Jar"

5) For running outside of the Eclipse IDE, you must make sure the .jar 
   file is present and your -cp (Classpath) argument is set correctly.
Run Code Online (Sandbox Code Playgroud)

  • 谢谢paulsm4.谷歌删除了对Apache HTTP客户端的支持,根据这个:https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client你自己必须下载一个来自http://www.java2s.com/code/Jar/h/Downloadhttpcore401jar.htm的httpcore-4.0.1.jar的副本将其导入libs文件夹.这将解决问题.Proguard异常:-dontwarn org.apache.http.**-dontwarn com.android.volley.toolbox.** (2认同)