gpt4 book ai didi

java - 'org.apache.http.HttpEntity' 已弃用。如何解决android studio中的这个错误?

转载 作者:太空狗 更新时间:2023-10-29 23:01:20 27 4
gpt4 key购买 nike

我正在使用 android studio API22,但出现以下错误:

'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

我该如何解决这个问题?

最佳答案

将这个添加到你的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'
}

关于java - 'org.apache.http.HttpEntity' 已弃用。如何解决android studio中的这个错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30556605/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com