_067_android_androidStudio没有httpclient的解决办法

转自https://blog.csdn.net/u014727233/article/details/51985429,感谢作者的无私分享。 

1.build.gradle(module:app)中添加下列两行代码

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.newbest.smarthome.howtoaddhttpclient"
        minSdkVersion 18
        targetSdkVersion 24
        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:24.0.0'
    compile "org.apache.httpcomponents:httpcore:4.3.2"
}

2.点击顶部菜单栏的"sync project with gradle files",整理gradle完毕即可使用httpclient

猜你喜欢

转载自blog.csdn.net/poiuyppp/article/details/84851716