Any progress on Android support?

311 views
Skip to first unread message

Konrad Malawski

unread,
May 7, 2011, 4:08:50 PM5/7/11
to asyncht...@googlegroups.com
Hi,
I really love your library but it sadly doesn't seem to be compatible with Android devices. It's falling back to the JDK implementation, which obviously isn't supported on the DVM.

05-07 19:44:34.990: ERROR/AndroidRuntime(262): java.lang.VerifyError: com.ning.http.client.providers.jdk.JDKAsyncHttpProvider
        at com.ning.http.client.AsyncHttpClient.loadDefaultProvider(AsyncHttpClient.java:555)
        at com.ning.http.client.AsyncHttpClient.<init>(AsyncHttpClient.java:180)
        at com.ning.http.client.AsyncHttpClient.<init>(AsyncHttpClient.java:162)

I saw your discussion at https://groups.google.com/forum/#!topic/asynchttpclient/Ml6bOndZbDY but sadly it didn't have a solution. If you have an idea on how to fix this, please let me know - I'm currently playing around with other *AsyncHttpProvider's - hopefully something nice will come out of it. The ApacheAsyncHttpProvider also seems to fail, I have not yet been able to try out the Netty implementation - will do so in a few hours. Could you suggest any nice way out of this situation? The other project (project Android is using OtherProject which is using AsyncHttpClient) which is using AsyncHttpClient is also my opensource code, so if making it work on Android is a problem I'll switch over to some other provider - but would very much like to stay with your lib - as I already said, it's just great... :-)

In the worst case scenario I would have to implement my own AsyncHttpProvider I guess, but that's not really something I would like to do now.
I'm open to any suggestions and ideas.

-- 
Thanks a lot in advance,
Konrad

jfarcand

unread,
May 9, 2011, 8:09:29 AM5/9/11
to asyncht...@googlegroups.com
Salut,

I've never worked with Android so I will need some help in order to
diagnose the issue. Can you try to create the JDKAsyncHttpProvider
directly instead of letting the library creates it?

AsyncHttpClient c = new AsyncHttpClient(new JDKAsyncHttpProvider(new
AsyncHttpClientConfig.Builder().build()));

Thanks!

-- Jeanfrancois

> --
> You received this message because you are subscribed to the Google
> Groups "asynchttpclient" group.
> To post to this group, send email to asyncht...@googlegroups.com.
> To unsubscribe from this group, send email to
> asynchttpclie...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/asynchttpclient?hl=en.

Konrad Malawski

unread,
May 9, 2011, 6:14:15 PM5/9/11
to asyncht...@googlegroups.com
Hi and thanks for your response.

Yes I tried it like you suggested (tried it again just now to be sure), it results in:

05-09 22:04:48.857: ERROR/AndroidRuntime(288): Uncaught handler: thread main exiting due to uncaught exception
05-09 22:04:48.867: ERROR/AndroidRuntime(288): java.lang.VerifyError: com.ning.http.client.providers.jdk.JDKAsyncHttpProvider
        at pl.llp.kanbanery.guice.JanbaneryProvider.getRestClient(JanbaneryProvider.java:46)
        at pl.llp.kanbanery.guice.JanbaneryProvider.get(JanbaneryProvider.java:32)
        at pl.llp.kanbanery.guice.JanbaneryProvider.get(JanbaneryProvider.java:18)

In the end I just switched my high level "RestClient" which does some additional things to the http client implementation that is native to Android, that is to the packages -> org.apache.http.* (org.apache.http.impl.client.DefaultHttpClient).
So if we'd be able to implement an AsyncHttpProvider using the DefaultHttpClient from Apache, AsyncHttpClient would probably get it's Android support :-) I may research this further in some freetime hmm... If I come up with an implementation I'll be sure to let you know about it :-)
My basic implementation is enough for now for me, I didn't really harness the async part of your library in this project yet so a simple implementation was easy to swap in.

--
Thanks a lot for your response and good work on AHC :-)
Konrad

jfarcand

unread,
May 10, 2011, 8:22:08 AM5/10/11
to asyncht...@googlegroups.com
Salut,

On 11-05-09 6:14 PM, Konrad Malawski wrote:
> Hi and thanks for your response.
>
> Yes I tried it like you suggested (tried it again just now to be sure),
> it results in:
>
> 05-09 22:04:48.857: ERROR/AndroidRuntime(288): Uncaught handler: thread
> main exiting due to uncaught exception
> 05-09 22:04:48.867: ERROR/AndroidRuntime(288): java.lang.VerifyError:
> com.ning.http.client.providers.jdk.JDKAsyncHttpProvider
> at
> pl.llp.kanbanery.guice.JanbaneryProvider.getRestClient(JanbaneryProvider.java:46)
> at pl.llp.kanbanery.guice.JanbaneryProvider.get(JanbaneryProvider.java:32)
> at pl.llp.kanbanery.guice.JanbaneryProvider.get(JanbaneryProvider.java:18)

Thanks for sharing. I've filled:

https://issues.sonatype.org/browse/AHC-91

to track the issue. I've never developped with Android so I will need a
couple of days to install the dev env and see wha


>
> In the end I just switched my high level "RestClient" which does some
> additional things to the http client implementation that is native to
> Android, that is to the packages -> org.apache.http.*
> (org.apache.http.impl.client.DefaultHttpClient).
> So if we'd be able to implement an AsyncHttpProvider using the
> DefaultHttpClient from Apache, AsyncHttpClient would probably get it's
> Android support :-) I may research this further in some freetime hmm...
> If I come up with an implementation I'll be sure to let you know about
> it :-)

Thanks!

> My basic implementation is enough for now for me, I didn't really
> harness the async part of your library in this project yet so a simple
> implementation was easy to swap in.
>
> --
> Thanks a lot for your response and good work on AHC :-)

Thanks! Let me know how it goes!

-- Jeanfrancois

Konrad Malawski

unread,
May 10, 2011, 9:04:04 AM5/10/11
to asyncht...@googlegroups.com
Thanks for opening the issue on jira, good idea.
I'll try to implement it some time after GeeCON which is taking place this week and I'm very much involved there as an organizer so won't have any time this week to hack around...

Anyways, let's continue about this matter in the jira issue, thanks again for your quick responses :-)

--
Konrad

emanuele

unread,
Jul 5, 2011, 4:38:20 AM7/5/11
to asynchttpclient
Any progress supporting async http client on android? what about the
pipelining support?

Thanks and sorry for bothering u

jfarcand

unread,
Jul 6, 2011, 11:22:35 AM7/6/11
to asyncht...@googlegroups.com
Salut,

I'm not longer full time on this project (specially for the next 3
months)...hence if you need support, you will need to submit patches :-) :-)

Any contribution welcomed!

Thanks!

-- Jeanfrancois

Reply all
Reply to author
Forward
0 new messages