无法重新获得符号' HttpGet'

时间:2016-05-05 09:26:24

标签: android

真的找不到问题..

主要活动

@Override
        protected String doInBackground(Context... params) {

            try {
                //HttpGet get = new HttpGet( "http://services.groupkt.com/state/get/IND/all");
                HttpGet get = new HttpGet("http://labour.gov.in/pencilapp/reports");
                //HttpGet get = new HttpGet("http://10.25.120.72/ssds/2.0/webservices/kyl?acronym=PAN&identifier=AAACC0909K");
                // get.setHeader("Content-Type", "application/json");
                HttpResponse response = client.execute(get);

                HttpEntity entity = response.getEntity();
                String responseString = EntityUtils.toString(entity, "UTF-8");
                return responseString;

            } catch (Exception e) {
                e.printStackTrace();
            }

            return null;
        }

Build.gradle文件

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"


    defaultConfig {
        applicationId "com.example.acer.shramsuvidha"
        minSdkVersion 9
        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.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'org.apache.httpcomponents:httpcore:4.4.1'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile files('libs/gson-2.2.4.jar')
    compile 'com.google.code.gson:gson:2.3'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'org.apache.httpcomponents:httpcore:4.4.3'
    }

1 个答案:

答案 0 :(得分:0)

添加

useLibrary'org.apache.http.legacy'

你的build.gradle中的