无法在android studio中解析符号DefaultHttpClient,HttpGet和HttpPost

时间:2015-12-15 12:00:33

标签: java android httpclient

这个问题不重复,因为我尝试了以下解决方案。

Cannot resolve symbol HttpGet,HttpClient,HttpResponce in Android Studio

我的申请中的

Can't resolve symbol 'Defaulthttpclient' and 'Httppost' in android解决方案。

我在 gradle 文件中添加了2个依赖项,并同步我的项目。

compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'

仍然无法获得解决方案。

之后我尝试手动导入 import org.apache.http.impl.client.DefaultHttpClient; 。这个解决方案无法帮助我。

仍然无法正常工作。请帮帮我。

build.gradel

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "<my Package>"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile 'org.apache.httpcomponents:httpclient:4.5.1'

}

0 个答案:

没有答案