错误:(12,23)java:package org.apache.http不存在

时间:2017-02-05 09:25:53

标签: android android-apache-legacy

我的android项目不包含build.gradle来放置useLibrary 'org.apache.http.legacy'

enter image description here

1 个答案:

答案 0 :(得分:0)

示例Build.gradle

apply plugin: 'com.android.application'

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.Sample.App"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.1"
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
        }
        debug {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
            debuggable true
            jniDebuggable true
            renderscriptDebuggable true
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
}

enter image description here