HttpClient 在我的 android studio 1.4 中不起作用

pra*_*d K 5 android android-studio

首先抱歉我的英语不好我是 android studio 1.4 的新手,我在 HttpClient 中遇到错误

错误

C:\Users\madhu\AndroidStudioProjects\LoginAndsign\app\src\main\java\com\login\loginandsign\SimpleHttpClient.java

Error:(27, 20) error: cannot find symbol class HttpClient

Error:(34, 20) error: cannot find symbol class HttpClient

Error:(36, 31) error: cannot find symbol class DefaultHttpClient

Error:(40, 13) error: cannot find symbol variable ConnManagerParams


Error:(57, 13) error: cannot find symbol class HttpClient

Error:(58, 13) error: cannot find symbol class HttpPost

Error:(58, 36) error: cannot find symbol class HttpPost

Error:(59, 13) error: cannot find symbol class UrlEncodedFormEntity

Error:(59, 51) error: cannot find symbol class UrlEncodedFormEntity

Error:(96, 13) error: cannot find symbol class HttpClient

Error:(97, 13) error: cannot find symbol class HttpGet

Error:(97, 35) error: cannot find symbol class HttpGet
Run Code Online (Sandbox Code Playgroud)

我添加了以下依赖项,但仍然显示相同的错误

dependencies {
compile 'com.google.android.gms:play-services:+'
compile 'org.apache.httpcomponents:httpclient:4.2.6'
compile 'org.apache.httpcomponents:httpmime:4.2.6'
compile files('libs/core.jar')
}
Run Code Online (Sandbox Code Playgroud)

Moh*_*med 3

HttpClient在 Android 6.0 中被删除。

要继续使用HttpClient,请将以下代码添加到您的build.gradle

 android{
    compileSdkVersion 23
    buildToolsVersion '23.0.1'
    useLibrary  'org.apache.http.legacy'
}
Run Code Online (Sandbox Code Playgroud)