5

I'm using Google's Download library for expansion pack downloading as distributed through the 'Android SDK' manager. Building using Eclipse/Ant since haven't migrated to AS/Gradle yet - but any solution would help.

In API 23 Apache HTTP goes away. And I already implemented a workaround to get Google's LVL to compile. (Lvl library and android marshmallow)

But the download library is substantially larger beast to tackle and not sure I really want to fix Google's code - probably just write my own instead if necessary.

Does anyone know of a convenient "drop in" (-ish) replacement library or suitable workaround?

~~

Compile errors for unavailable imports in 'com.google.android.vending.expansion.downloader.impl.AndroidHttpClient'

import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpException; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.params.HttpClientParams; import org.apache.http.client.protocol.ClientContext; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.conn.scheme.SocketFactory; import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.entity.AbstractHttpEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.RequestWrapper; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.HttpContext;

Community
  • 1
  • 1
DevByStarlight
  • 1,070
  • 13
  • 17
  • hi there did you resolve it? it is really frustrating that task is almost done and got stuck at this point that we can't use their own Library coz they made it outdated with android 6 launch, wow...! – mfaisalhyder Jun 20 '16 at 19:50
  • Frankly, I became frustrated with a number of API 22-to-23 migration issues - this apache thing, dex method limits, permission changes, etc. Thus I suspended the endeavour and I simply left my app at API 22. (And subsequently started a new, from scratch, Android Studio / gradle project instead. (fwiw, my IOS projects are far far easier to migrate but, alas, that's comparing apples to some-sort-of-non-apple-fruit) – DevByStarlight Nov 01 '16 at 18:10

1 Answers1

3
Okay, a bit of github searching and found a solution. Ironically, it's mentioned in stackoverflow too - I just didn't use right keywords in my search I suppose. So if you happen to arrive here, then bounce on over to SMarek's question/answer/solution and give +1 the answer. Solution: (http://stackoverflow.com/q/32178854/735533) Library: (https://github.com/smarek/httpclient-android)

Edit:

NOTE: As of Oct 26, 2015, SMarek's library above doesn't quite build successfully as-is

Meanwhile, it turns out there is an "easier" drop-in solution for Ant users in lieu of the "usesLibrary org.apache.http.legacy" option for gradle users.

  • Copy SDK/platforms/android-23/optional/org.apache.http.legacy.jar into application's ./libs directory
  • (and add jar to build path classpath, etc)
  • Then add the following to proguard

    -keep class org.apache.http.** { *; }
    -dontwarn org.apache.http.**
    -dontwarn android.net.**

NOTE: The android.net 'dontwarn' will mask OpenSSL calls ("android.net.http.SslCertificate"). In my case it arises from WebKit which I'm not using (although 3rd party libs might)

Unfortunately, it pushed my app over the 65k limit. Never a dull moment.

DevByStarlight
  • 1,070
  • 13
  • 17