Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Legacy Apache in Eclipse in order to support Android M

On Android M, Google has completely removed the support of Apache HTTP client.

This might also be the cause for so many apps crashing on Android M.

From the Google Dev resources:

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.

I'm using Eclipse and I don't have Gradle, is there any workaround for this?

I really need to update an app pretty quickly but I can't port it to Android Studio right now

like image 559
LS_ Avatar asked Sep 01 '15 09:09

LS_


1 Answers

Find org.apache.http.legacy.jar which is in Android/Sdk/platforms/android-23/optional, add it to your dependency.

like image 56
Derek Fung Avatar answered Oct 09 '22 00:10

Derek Fung