的NameValuePair错误"的NameValuePair不能被解析为一个类型"错误、类型、NameValuePair、QUOT

2023-09-12 10:09:14 作者:挽手说余生。

我为新的Andr​​oid和即时创建类似的本教程及其显示类似如下photo.Please错误帮我出这一点。的

I m new in android and i m creating a project like

推荐答案

您项目的 compileSdkVersion 设置为23,Apache's HttpClient库,从Android SDK中删除的API等级23 。

Your project's compileSdkVersion is set to 23. Apache's HttpClient library was removed from the Android SDK in API Level 23.

如果您在 compileSdkVersion 更改为21,你的应用程序将汇编干净。或者,有一个解决办法继续使用的HttpClient在Android的6.0与Android工作室。然而,对于长期的发展,你真的需要移动到一个HTTP API别的东西。这别的东西可以是:

If you change your compileSdkVersion to 21, your app will compile cleanly. Or, there is a workaround to continue using HttpClient in Android 6.0 with Android Studio. However, for long-term development, you really need to move to something else for an HTTP API. 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).