Quantcast

Dispatch 0.8.1 on Android

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dispatch 0.8.1 on Android

Nolan Darilek
I'm trying to upgrade from 0.7.8 to 0.8.1 in an Android project, and am running into the following traceback:

E/AndroidRuntime( 2271): FATAL EXCEPTION: main

E/AndroidRuntime( 2271): java.lang.NoClassDefFoundError: dispatch.ConfiguredHttpClient$$anon$1

E/AndroidRuntime( 2271): at dispatch.ConfiguredHttpClient.<init>(ConfiguredHttpClient.scala:31)

E/AndroidRuntime( 2271): at dispatch.BlockingHttp$class.make_client(Http.scala:41)

E/AndroidRuntime( 2271): at dispatch.Http.make_client(Http.scala:21)

E/AndroidRuntime( 2271): at dispatch.BlockingHttp$class.$init$(Http.scala:39)

E/AndroidRuntime( 2271): at dispatch.Http.<init>(Http.scala:21)

E/AndroidRuntime( 2271): at com.serotek.iblink.service.Puller.<init>(service.scala:165)

E/AndroidRuntime( 2271): at java.lang.Class.newInstanceImpl(Native Method)

E/AndroidRuntime( 2271): at java.lang.Class.newInstance(Class.java:1409)

E/AndroidRuntime( 2271): at android.app.ActivityThread.handleCreateService(ActivityThread.java:1926)

E/AndroidRuntime( 2271): at android.app.ActivityThread.access$2500(ActivityThread.java:117)

E/AndroidRuntime( 2271): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)

E/AndroidRuntime( 2271): at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime( 2271): at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime( 2271): at android.app.ActivityThread.main(ActivityThread.java:3683)

E/AndroidRuntime( 2271): at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime( 2271): at java.lang.reflect.Method.invoke(Method.java:507)

E/AndroidRuntime( 2271): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

E/AndroidRuntime( 2271): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)

E/AndroidRuntime( 2271): at dalvik.system.NativeStart.main(Native Method)


This is under Android 2.3. I'm only depending on dispatch-http 0.8.1, and am doing

new Http

as I did under 0.7.8.

Do I need a different, non-default executor on Android? Or is there some new setup work required?

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dispatch 0.8.1 on Android

n8han
Administrator
On 05/16/2011 11:41 AM, Nolan Darilek [via Databinder] wrote:
> I'm trying to upgrade from 0.7.8 to 0.8.1 in an Android project, and
> am running into the following traceback:
>
> E/AndroidRuntime( 2271): FATAL EXCEPTION: main
>
> E/AndroidRuntime( 2271): java.lang.NoClassDefFoundError:
> dispatch.ConfiguredHttpClient$$anon$1

This looks like a proguard problem to me, that it has stripped out a
class that is needed. This *might* help:
https://github.com/meetup/snapup-android/blob/master/project/build/Project.scala

As a test I started to migrate Snapup to dispatch-nio--but don't do
that. NIO on Android is broken in a half dozen ways between "old"
version of Android (such as 2.1) and the old version of HttpClient that
is shipped with the platform.

But, I know that I got far enough to execute requests and I think I also
tested with the regular dispatch-http (0.8.0) before that, so the
proguardOptions that are in that project file may be of use to you.

Nathan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dispatch 0.8.1 on Android

n8han
Administrator
In reply to this post by Nolan Darilek
Hi Nolan, Doug just found another issue that will be harder to work
around. Dispatch 0.8.1 uses a newer version of HttpClient than what's
packaged with Android and it does reference some classes that don't
exist in the old version. You are probably better off sticking with
Dispatch 0.7.8 for the time being.

Nathan

On 05/16/2011 12:47 PM, Nathan Hamblen wrote:

> On 05/16/2011 11:41 AM, Nolan Darilek [via Databinder] wrote:
>> I'm trying to upgrade from 0.7.8 to 0.8.1 in an Android project, and
>> am running into the following traceback:
>>
>> E/AndroidRuntime( 2271): FATAL EXCEPTION: main
>>
>> E/AndroidRuntime( 2271): java.lang.NoClassDefFoundError:
>> dispatch.ConfiguredHttpClient$$anon$1
>
> This looks like a proguard problem to me, that it has stripped out a
> class that is needed. This *might* help:
> https://github.com/meetup/snapup-android/blob/master/project/build/Project.scala 
>
>
> As a test I started to migrate Snapup to dispatch-nio--but don't do
> that. NIO on Android is broken in a half dozen ways between "old"
> version of Android (such as 2.1) and the old version of HttpClient
> that is shipped with the platform.
>
> But, I know that I got far enough to execute requests and I think I
> also tested with the regular dispatch-http (0.8.0) before that, so the
> proguardOptions that are in that project file may be of use to you.
>
> Nathan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dispatch 0.8.1 on Android

n8han
Administrator
In case anybody's curious, I added a page on this topic to the documentation:
http://dispatch.databinder.net/Dispatch+in+Android.html

Nathan
Loading...