android提供的json版本的Apache http客户端错误 [英] Apache http client error with json version provided by android

查看:32
本文介绍了android提供的json版本的Apache http客户端错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 url 解析 json,Apache http 客户端从 Android API 级别 23 中删除.如果我在 android studio 中使用 httpclient.jar 文件,它会显示如下错误:

I am trying to parse json from url, Apache http client removed from Android API level 23. If I use httpclient.jar files in android studio, it shows error like:

"警告:Dependency org.json:json:20090211 在调试时被忽略,因为它可能与Android提供的内部版本冲突."

"Warning:Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android."

dependencies{

    compile files('libs/httpclient-4.5.1.jar')
    compile files('libs/httpcore-4.5.1.jar')
}

如何解决此错误.

谢谢.

推荐答案

如果您只想在 sdk23 中使用 apache 客户端.难道你尝试在gradle中使用添加这段代码.

if you just want to use apache client in sdk23. doDo you try to useadd this code in gradle.

android {
    useLibrary 'org.apache.http.legacy'
}

参见 HttpClient 不会在 Android Studio 中导入

这篇关于android提供的json版本的Apache http客户端错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆