ClassNotFoundException: Didn't find class "org.apache.http.message.BasicNameValuePair"解决方法
程序员文章站
2022-03-26 19:25:36
...
在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'
}
上一篇: Redis Cluster集群
下一篇: 聊聊Mysql主从同步读写分离配置实现
推荐阅读
-
Android <java.lang.ClassNotFoundException:Didn‘t find class ‘XXX‘ on path:DexPathList> 解决
-
Didn't find class "com.google.firebase.provider.FirebaseInitProvider"
-
Android <java.lang.ClassNotFoundException:Didn‘t find class ‘XXX‘ on path:DexPathList> 解决
-
ClassNotFoundException: Didn't find class "org.apache.http.message.BasicNameValuePair"解决方法