HttpClient 사용하기 - AndroidStudio

CODEDRAGON Development/Android

반응형

   

HttpClient 사용하기 - AndroidStudio

Android SDK API 23부터는 HttpClient를 더이상 지원하지 않아 HttpClient 를 사용하기 위해서는 추가적인 작업이 필요합니다.

  • useLibrary 추가 하기
  • 버전 다운그레이드 하기

   

   

useLibrary 추가 하기

build.gradle(Module:app)에

useLibrary'org.apache.http.legacy' 항목을 추가해 주세요

android {

    compileSdkVersion 23

    buildToolsVersion "23.0.2"

   

    defaultConfig {

        applicationId "com.tistory.codedragon.a52newsxml"

        minSdkVersion 15

        targetSdkVersion 23

        versionCode 1

        versionName "1.0"

    }

    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }

   

    useLibrary'org.apache.http.legacy'

}

  

   

   

버전 다운그레이드 하기

버전을 23 -> 22로 사용 버전을 낮춰줍니다.

android{

    compileSdkVersion 23

    buildToolsVersion "23.0.2"

   

    defaultConfig{

        applicationId"com.tistory.codedragon.a52newsxml"

        minSdkVersion 15

        targetSdkVersion 23

        versionCode 1

        versionName "1.0"

    }

    buildTypes{

        release{

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }

}

   

}

dependencies{

    compilefileTree(dir:'libs',include:['*.jar'])

    testCompile'junit:junit:4.12'

    compile'com.android.support:appcompat-v7:23.1.0'

}

android{

    compileSdkVersion 22

    buildToolsVersion "22.0.2"

   

    defaultConfig{

        applicationId"com.tistory.codedragon.a52newsxml"

        minSdkVersion 15

        targetSdkVersion 22

        versionCode 1

        versionName "1.0"

    }

    buildTypes{

        release{

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }

}

dependencies{

    compilefileTree(dir:'libs',include:['*.jar'])

    testCompile'junit:junit:4.12'

    compile'com.android.support:appcompat-v7:22.1.0'

}

   

   

   

Apache HTTP Client Removal

https://developer.android.com/intl/ko/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

 

반응형