Wednesday, February 25, 2009

Android SDK + eBay SDK

I haven't done anything with Android in a while, so I thought I would see whether I could get my phone talking to eBay. I grabbed the eBay SDK for Java, stuck it in my project, wrote a small demo app, tried it out, and BOOM!

VFY: unable to resolve new-instance 1516 (Ljavax/swing/event/EventListenerList;) in Lcom/ebay/sdk/ApiCredential;
VFY: rejecting opcode 0x22 at 0x0015
VFY: rejected Lcom/ebay/sdk/ApiCredential;.<init> ()V
Verifier rejected class Lcom/ebay/sdk/ApiCredential;
Shutting down VM
threadid=3: thread exiting with uncaught exception (group=0x4000fe68)
Uncaught handler: thread main exiting due to uncaught exception
java.lang.VerifyError: com.ebay.sdk.ApiCredential
at com.ebay.sdk.ApiContext.<init>(ApiContext.java:41)
at org.balefrost.bodacious.Bodacious.onCreate(Bodacious.java:75)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2157)
at android.app.ActivityThread.access$1800(ActivityThread.java:112)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
at android.os.Handler.dispatchMessage(Handler.java:88)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3739)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
at dalvik.system.NativeStart.main(Native Method)

It looks like it depends on a Swing class (EventListenerList), but Swing isn't available on Android. I guess I'm rolling it by hand then. It's actually unfortunate that EventListenerList is a part of Swing - it looks generic enough that maybe it should be promoted to the core library. For that matter, I'm a little surprised that this made it past the apk builder. Perhaps that is outside the scope of the apk builder.