DefaultHttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("xxxxxxx");
古老的代码,又不想去改,然后突然搬移项目就找到不包了,
首先这肯定是apace的包,那么想想原来没有问题现在却又问题了。对比一下。真的很难找出
解决的时候就是在这里,添加一行
useLibrary 'org.apache.http.legacy'
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
useLibrary 'org.apache.http.legacy'
applicationId "xxxx"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
真的是不想碰这些古老的东西。肯定没必要也没人想去重新编辑兼容它。哈哈(一脸嫌弃,嘻嘻)
参考资料:https://bbs.youkuaiyun.com/topics/391855151