Has anyone tried to use a newer version of Apache HttpClient on Android? There's an annoying bug in the HttpClient used by Android and I was wondering if I would run into problems trying to redistribute HttpClient 4.1 with my app.
5
votes
5 Answers
6
votes
I created a script to convert a stock HttpClient release into an Android library project. The packages are renamed so that there's no confusion of which classes are used.
Also ThreadSafeClientConnManager and Scheme work just fine.
Take a look: httpclientandroidlib
2
votes
2
votes
1
votes
There's an official android port of apache HttpClient you can find in maven repository (or look for "httpclient-android").
Sadly Android comes with a fork of apache HttpClient built in and it's stuck in version 4.0.
0
votes
I was running 4.1 just fine until I started using ThreadSafeClientConnManager and Scheme which produced some nasty runtime errors.
ERROR/dalvikvm(1077): Could not find method org.apache.http.conn.scheme.Scheme.<init>, referenced from method com.example.MyActivity.download
WARN/dalvikvm(1077): VFY: unable to resolve direct method 3290: Lorg/apache/http/conn/scheme/Scheme;.<init> (Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V
WARN/dalvikvm(1077): VFY: rejecting opcode 0x70 at 0x0035
I suspect the older Scheme in Android API is used which has a different constructor.