本文介绍了'org.apache.http.HttpEntity' 已弃用.如何解决android studio中的这个错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 android studio API22,但出现以下错误:
i'm using android studio API22 and i have these errors:
'org.apache.http.HttpEntity' is deprecated
'org.apache.http.HttpResponse' is deprecated
'org.apache.http.NameValuePair' is deprecated
'org.apache.http.client.HttpClient' is deprecated
'org.apache.http.client.entity.UrlEncodedFormEntity' is deprecated
'org.apache.http.client.methods.HttpPost' is deprecated
'org.apache.http.impl.client.DefaultHttpClient' is deprecated
'org.apache.http.message.BasicNameValuePair' is deprecated
'org.apache.http.params.BasicHttpParams' is deprecated
'org.apache.http.params.HttpConnectionParams' is deprecated
'org.apache.http.params.HttpParams' is deprecated
'org.apache.http.util.EntityUtils' is deprecated
我该如何解决这个问题?
How can i solve this?
推荐答案
将此添加到您的 gradle
Add this to your gradle
useLibrary 'org.apache.http.legacy'
示例
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 2
versionName "1.0.1"
}
buildTypes {
release {
debuggable false
signingConfig signingConfigs.releaseConfig
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debugSigned {
debuggable true
signingConfig signingConfigs.releaseConfig
}
debug {
debuggable true
}
}
useLibrary 'org.apache.http.legacy'
}
这篇关于'org.apache.http.HttpEntity' 已弃用.如何解决android studio中的这个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!