关于androidstuio运行程序遇到 Error:(11, 8) 错误: 无法访问HttpEntity 找不到org.apache.http.HttpEntity的类文件解决方法

来源:互联网 发布:域名出售平台哪个好 编辑:程序博客网 时间:2024/06/06 00:34

主要是targetsdk23以上版本不在支持,如果需要使用的话,在build.gradle文件中添加配置:useLibrary "org.apache.http.legacy"


如:


apply plugin: 'com.android.application'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    useLibrary "org.apache.http.legacy"
    defaultConfig {
        applicationId "com.wang.op"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 2
        versionName "1.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


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

2 0
原创粉丝点击