我尝试过以下代码。我已经习惯在build.gradle的android部分中使用“useLibrary'org.apache.http.legacy'但是错误仍然出现,而且我在\ Android \ sdk \ platforms \ android-中也有org.apache.http.legacy.jar 23 \可选的。
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.bhuvneshgautam.cityretails"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
答案 0 :(得分:2)
删除
android {
useLibrary 'org.apache.http.legacy'
}
阻止然后复制jar并粘贴到your_application / app / libs /然后在依赖项中包含compile fileTree(dir:' libs',include:[' * .jar']) / p>
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
...
...
}
然后清理并重建项目