导入第三方Library SDK项目编译发现遇到
Error:(12, 23) 错误: 程序包org.apache.http不存在的情况,无论在android studio中怎么刷新,清理缓存就是无法正常引入该类,eclipse中没有这个问题。
最后在一篇博客上发现加入
useLibrary ‘org.apache.http.legacy’这行代码即可,原文地址也记不清了,在这里记录一下。
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 10
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:multidex:1.0.1'
}