无法在机器人工作室进口org.apache.http.Htt presponse [英] Can't import org.apache.http.HttpResponse in android studio
问题描述
我想在Android的工作室使用这些库:
I want to use these libraries in android studio:
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
我下面的视频教程中,导师是使用Eclipse,所以我知道它的工作原理。
I am following a video tutorial in which the tutor is using Eclipse so I know it works.
但更多的东西/库,我一定要添加到AndroidStudio使用它们?
But what additional things/libraries I have to add to AndroidStudio to use them?
推荐答案
HttpClient的是pcated于Android的5.1和从Android SDK中去除的Android 6.0代$ P $。虽然有一个解决办法继续的Android 6.0使用的HttpClient与Android工作室,你真的需要转移到别的东西。这别的东西可以是:
HttpClient was deprecated in Android 5.1 and is removed from the Android SDK in Android 6.0. While there is a workaround to continue using HttpClient in Android 6.0 with Android Studio, you really need to move to something else. That "something else" could be:
- 内置经典的Java
的HttpURLConnection
- 为Android Apache的独立包装的HttpClient
- OkHttp (我的建议)
- AndroidAsync
- the built-in classic Java
HttpUrlConnection
- Apache's independent packaging of HttpClient for Android
- OkHttp (my recommendation)
- AndroidAsync
或者,这取决于你的HTTP的工作性质,你可以选择支持更高阶的操作(例如,用于改造Web服务API)库。
Or, depending upon the nature of your HTTP work, you might choose a library that supports higher-order operations (e.g., Retrofit for Web service APIs).
这篇关于无法在机器人工作室进口org.apache.http.Htt presponse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!