分享

Android Studio 更新 Android 6.0 之后无法找到 org.apache.http 包的问题

 harryyuan 2015-12-14

Android Studio 更新 Android 6.0 之后无法找到 org.apache.http 包的问题

这么重要的问题竟然事先说明,太过分了。

今天更新了 Android 6.0 的 SDK 后发现项目一片红,吓尿了。

直接引用把:http://developer./about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

Android 6.0 release removes support for the Apache HTTP client. If your app is using this client and targets Android 2.3 (API level 9) or higher, use theHttpURLConnection class instead. This API is more efficient because it reduces network use through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:

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

大概意思就是,Android 6.0不再支持 Apache HTTP client。 请使用HttpURLConnection 代替。想要继续使用 Apache HTTP client 的,请添加如上代码。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多