在Androdid高版本中删除了httpclient相关的包
可通过在as中配置依赖解决:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
....
lintOptions {
abortOnError false
}
// 1.加入这句话
useLibrary 'org.apache.http.legacy'
}
// 2.加入以下这些
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
...
//3.加入以下这些
//noinspection DuplicatePlatformClasses
api 'org.apache.httpcomponents:httpclient:4.4.1'
}
网友评论