-1

Really cant find the problem..

Main Activity

@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 file

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'
    }
Saurabh Vardani
  • 1,821
  • 2
  • 18
  • 33
Pranav Kakkar
  • 33
  • 1
  • 6
  • [http://stackoverflow.com/questions/30856785/how-to-add-apache-http-api-legacy-as-compile-time-dependency-to-build-grade-fo](http://stackoverflow.com/questions/30856785/how-to-add-apache-http-api-legacy-as-compile-time-dependency-to-build-grade-fo) – M D May 05 '16 at 09:28

1 Answers1

0

Add

useLibrary 'org.apache.http.legacy'

in your build.gradle

Alessandro Verona
  • 1,157
  • 9
  • 23