且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache HTTP 连接与 Android 6.0 (Marshmallow)

更新时间:2021-10-24 05:45:23

This页面 讨论了 Apache HTTP 类的删除,并且还提出了一种解决方法:

This page discusses the removal of the Apache HTTP classes, and it suggests a workaround as well:

要继续使用 Apache HTTP API,您必须首先在 build.gradle 文件中声明以下编译时依赖项:

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 Studio 仍然抱怨找不到这些类,但该应用确实构建并运行了.

In my case Android Studio still complained that it couldn't find these classes, but the app did build and run.

该页面确实建议您转到 HttpURLConnection.

The page does recommend you move to HttpURLConnection, though.