Anyone tried using async http client on Android?

1,290 views
Skip to first unread message

Tatu Saloranta

unread,
Oct 19, 2010, 9:29:04 PM10/19/10
to asyncht...@googlegroups.com
Quick question: I am trying to run a simple app (ning external api
java client) on Android, and it fails due to bytecode verification
error, trying to load JDK-based provider (not sure why). Now it may be
that async http client can't run on Android but on off chance that
someone else has tried to run it on (or was planning), I hoped to see
if there are some known gotchas. Specific error is cryptic enough that
it could also be (yet another) bug on Android's VM or class library:

10-19 18:25:13.135: ERROR/AndroidRuntime(287): java.lang.VerifyError:
com.ning.http.client.providers.jdk.JDKAsyncHttpProvider
10-19 18:25:13.135: ERROR/AndroidRuntime(287): at
com.ning.http.client.AsyncHttpClient.loadDefaultProvider(AsyncHttpClient.java:506)

-+ Tatu +-

jfarcand

unread,
Oct 19, 2010, 10:43:16 PM10/19/10
to asyncht...@googlegroups.com
Salut,

Can you try:

httpClient = new HttpClient(new JDKAsyncHttpProvider(config));

to see if that make a difference (it shouldn't, but I have a small doubt)

A+

-- Jeanfrancois


>
> -+ Tatu +-
>

Tatu Saloranta

unread,
Oct 20, 2010, 7:59:47 PM10/20/10
to asyncht...@googlegroups.com

Sure, tried that last night, did not work either. :-)

Some things I did notice, when doing minor troubleshooting:

(a) Looks like async provider also has static dependency on JDK backed
version; this seems unfortunate (it looks like it is linked to allow
using Windows-specific authentication (NTLM?) that only JDK provides,
due to licensing... something apache hc also does not provide).
(b) Fallback to use JDK version is done automatically -- IMO this is
bit dangerous and I would prefer that users would have to explicitly
configure it to be used (but maybe that's just me).

-+ Tatu +-

jfarcand

unread,
Oct 20, 2010, 9:05:11 PM10/20/10
to asyncht...@googlegroups.com
Salut,

On 10-10-20 7:59 PM, Tatu Saloranta wrote:
> On Tue, Oct 19, 2010 at 7:43 PM, jfarcand<jfarca...@gmail.com> wrote:
>> Salut,
>>
>> On 10-10-19 9:29 PM, Tatu Saloranta wrote:
>>>
>>> Quick question: I am trying to run a simple app (ning external api
>>> java client) on Android, and it fails due to bytecode verification
>>> error, trying to load JDK-based provider (not sure why). Now it may be
>>> that async http client can't run on Android but on off chance that
>>> someone else has tried to run it on (or was planning), I hoped to see
>>> if there are some known gotchas. Specific error is cryptic enough that
>>> it could also be (yet another) bug on Android's VM or class library:
>>>
>>> 10-19 18:25:13.135: ERROR/AndroidRuntime(287): java.lang.VerifyError:
>>> com.ning.http.client.providers.jdk.JDKAsyncHttpProvider
>>> 10-19 18:25:13.135: ERROR/AndroidRuntime(287): at
>>>
>>> com.ning.http.client.AsyncHttpClient.loadDefaultProvider(AsyncHttpClient.java:506)
>>
>> Can you try:
>>
>> httpClient = new HttpClient(new JDKAsyncHttpProvider(config));
>>
>> to see if that make a difference (it shouldn't, but I have a small doubt)
>
> Sure, tried that last night, did not work either. :-)
>
> Some things I did notice, when doing minor troubleshooting:
>
> (a) Looks like async provider also has static dependency on JDK backed
> version; this seems unfortunate (it looks like it is linked to allow
> using Windows-specific authentication (NTLM?) that only JDK provides,
> due to licensing... something apache hc also does not provide).

Right. I needed support for NTLM :-) But you must pass the JDK's
property to enable it.

I will look at the Android stuff by downloading an emulator. Did you
make any progress in debugging?

> (b) Fallback to use JDK version is done automatically -- IMO this is
> bit dangerous and I would prefer that users would have to explicitly
> configure it to be used (but maybe that's just me).

Agree. I've just cut 1.3.0, but I will add it as a explicit feature on
AsyncHttpProviderConfig.

Thanks!

Tatu Saloranta

unread,
Oct 20, 2010, 11:33:45 PM10/20/10
to asyncht...@googlegroups.com
On Wed, Oct 20, 2010 at 6:05 PM, jfarcand <jfarca...@gmail.com> wrote:
> Salut,
>
...

>> Some things I did notice, when doing minor troubleshooting:
>>
>> (a) Looks like async provider also has static dependency on JDK backed
>> version; this seems unfortunate (it looks like it is linked to allow
>> using Windows-specific authentication (NTLM?) that only JDK provides,
>> due to licensing... something apache hc also does not provide).
>
> Right. I needed support for NTLM :-) But you must pass the JDK's property to
> enable it.

Yeah I understand need for NTLM... unfortunate but necessary, :)

> I will look at the Android stuff by downloading an emulator. Did you make
> any progress in debugging?

No, I actually ended up implementing a separate wrapper for the client
API, just because we are doing a hackathon demo, to get things
working.
But I can maybe help once this is over.

I wonder if Netty and nio in general are supposed to work on Android or not.

>
>> (b) Fallback to use JDK version is done automatically -- IMO this is
>> bit dangerous and I would prefer that users would have to explicitly
>> configure it to be used (but maybe that's just me).
>
> Agree. I've just cut 1.3.0, but I will add it as a explicit feature on
> AsyncHttpProviderConfig.

That would be nice I think.

-+ Tatu +-

Reply all
Reply to author
Forward
0 new messages