Java.lang.verifyerror on Android with BOSH-version of Smack

Hello,

At the moment I’m trying to develop an android jabber client which connect with http-bind (since my provider only allows http-connections without making you poor). So I checked out the bosh version of Smack 3.2 from SVN and build it with ant. But as soon as I try to instantiate a Connection I get a java.lang.verifyerror. It seems to hang in the ConnectionConfiguration. I looked at the source but it seems that I don’t have enough knowledge about android and smack to solve this problem. Here is the error I get in LogCat:

11-20 08:23:17.542: ERROR/AndroidRuntime(714): Uncaught handler: thread main exiting due to uncaught exception
11-20 08:23:17.552: ERROR/AndroidRuntime(714): java.lang.VerifyError: org.jivesoftware.smack.util.DNSUtil
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at org.jivesoftware.smack.ConnectionConfiguration.<init>(ConnectionConfiguration.java:99)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at org.jivesoftware.smack.XMPPConnection.<init>(XMPPConnection.java:131)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at de.akuz.android.jabber.service.XMPPService.startXMPPConnection(XMPPService.java:154)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at de.akuz.android.jabber.service.XMPPService.onStart(XMPPService.java:233)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2557)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at android.app.ActivityThread.access$3100(ActivityThread.java:112)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1753)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at android.os.Looper.loop(Looper.java:123)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at android.app.ActivityThread.main(ActivityThread.java:3948)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at java.lang.reflect.Method.invokeNative(Native Method)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at java.lang.reflect.Method.invoke(Method.java:521)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
11-20 08:23:17.552: ERROR/AndroidRuntime(714):     at dalvik.system.NativeStart.main(Native Method)

I hope that someone can help or at least give me a hint how I get the bosh version of smack to run on android.

Thanks in advance

I’ve adjusted the jbosh sources and got a very simple sample application working with the BOSH branch of Smack and Android. See the attached android-smack.zip file for the sample application and jbosh-android.patch for the jbosh changes.

[edited] updated attachments for jbosh subversion revision 36 (also fixed some bugs) [edited]
android-smack.zip (340443 Bytes)
jbosh-android.patch.zip (9065 Bytes)

How did you build that?

You’ve patched jbosh to use the http client lib shipped with android (this is the attached patch, right?). You’ve then mixed this jar, the bosh branch of smack and the stock asmack jar, is that right?

Is their a need to get this into asmack? I’m thinking about merging it into asmack as it looks like an easy patch to integrate and a valuable one, too…

[EDIT] Ok, just read the jars, you got rid of XMPPConnection so most parts of the problematic code (like DNS/SRV) are skipped anyway

I had a second look at the patch:

  • it contains sun code (QName, see axis for an apache replacement)
  • there is no licence statement on the remaining code.
    Would it be ok for you to licence the remaining patch code under the apache licence?

treffer wrote:

I had a second look at the patch:

  • it contains sun code (QName, see axis for an apache replacement)
  • there is no licence statement on the remaining code.
    Would it be ok for you to licence the remaining patch code under the apache licence?

Yes the apache license is ok. The most part of the patch (ApacheHTTPSender.java and ApacheHTTPResponse.java) I’ve already wrote the Apache license into the header and the rest (besides the QName class from sun) are only very small modifications.

I’m not a lawyer, so do you think it’s ok to mix the CDDL and Apache License?

treffer wrote:

How did you build that?

The patch is only for the jbosh svn trunk version. I didn’t modified the the bosh branch of smack. So I’ve applied the patch to jbosh and build the lib and smack lib with maven without modifications.

I don’t have a android mobile so this code was only fun for me with no real usage at the moment, so be aware it can include bugs.

niess wrote:

I’m not a layer, so do you think it’s ok to mix the CDDL and Apache License?

IANAL too, but I’m not keen on leaving the apache license path :slight_smile: Anyway their seems to be an Apache implementation in Axis, so I’d just try to substitute the code…

To @Guenther Niess:Your job is so great!But I found a problem, it did not support Smack extensions API, I need Multi-User Chat, would you like continue your job expanding its support Smack extensions API do?Look forward to your reply

Hi Tom,

the smackx package from the bosh branch should already work. For the provided sample project, compile the smackx library, add it to the lib directory and configure the smack startup classes, IQ providers and packet extensions according to the attached patch. But note the two TODOs in the patch, you can find all smack providers within the smack.providers file from the smackx.jar archive.

Good luck!
smackx-config.patch.zip (1278 Bytes)