Skip to content Skip to sidebar Skip to footer

Org.apache.http Jar Class Not Found In Android Studio Projects

i include following jars see below image. I want to integrate json web service so i import below jars apache-mim44j-0.-6.jar gson-2.1.jar httpmime-4.0.1.jar json_simple-1.1.jar

Solution 1:

Apache HTTP Client was removed since API level 23:

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.

Reference: https://developer.android.com/preview/behavior-changes.html#behavior-apache-http-client

Solution 2:

You can use this link to download all libs. and then include

httpclient-4.5.1.jar httpcore-4.4.3.jar

and if get confilcts use these lines in buil.gradel

android {
 packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}

if get any more, click on highlited import and Alt+Enter. got solved by this

Post a Comment for "Org.apache.http Jar Class Not Found In Android Studio Projects"