Apache HTTP Client Removal from API23, will that have an effect on Volley?

后端 未结 6 528
盖世英雄少女心
盖世英雄少女心 2020-12-08 03:07

As we have known that Apache HTTP Client removed in API 23

Apache HTTP Client Removal

However, Volley library curr

相关标签:
6条回答
  • 2020-12-08 03:19

    Apache HTTP Client Removal This preview 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 the HttpURLConnection 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 is moving away from OpenSSL to the BoringSSL library. If you’re using the Android NDK in your app, don't link against cryptographic libraries that are not a part of the NDK API, such as libcrypto.so and libssl.so. These libraries are not public APIs, and may change or break without notice across releases and devices. In addition, you may expose yourself to security vulnerabilities. Instead, modify your native code to call the Java cryptography APIs via JNI or to statically link against a cryptography library of your choice.

    0 讨论(0)
  • 2020-12-08 03:20

    It seems there has been quite a mess with the Volley library in Android M. A bug has already been filed for it and acknowledged by google.

    https://code.google.com/p/android-developer-preview/issues/detail?id=3013

    You should star and track it for any further updates

    UPDATE

    Regarding your first question, you don't get an error for missing apache files because the library that you're using is still compiled using API 22

    ANDROID_BUILD_TARGET_SDK_VERSION=22
    ANDROID_BUILD_TOOLS_VERSION=22.0.1
    ANDROID_BUILD_SDK_VERSION=22
    

    https://github.com/mcxiaoke/android-volley/blob/master/gradle.properties

    Also check this open issue from the library according to which you can add legacy library

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.0"
    
        useLibrary 'org.apache.http.legacy'
        ...
    }
    
    0 讨论(0)
  • Add this to the de dependencies of your app, and then works correctly:

    dependencies { ... compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' }

    0 讨论(0)
  • 2020-12-08 03:30

    It's one huge hysteria about Apache's HTTP client. You can continue using it in any project you want without any consequences. Why waste time porting code to other libraries? I described the best way to continue using Apache's libraries here: https://stackoverflow.com/a/37623038/1727132 (spoiler: don't use legacy version!)

    0 讨论(0)
  • 2020-12-08 03:35
    android {
        useLibrary 'org.apache.http.legacy'
    }
    
    dependencies {
        compile 'commons-httpclient:commons-httpclient:3.1'
    }
    
    0 讨论(0)
  • 2020-12-08 03:41

    Appache Http is removed from android API level 23 if you still using the Apache Http client you can include android { useLibrary 'org.apache.http.legacy'} in your project - module build.gradle

    0 讨论(0)
提交回复
热议问题