[zeromq-dev] Unable to use ZeroMQ 3.2 in my Android application

Ranjeet Kumar xs2ranjeet at gmail.com
Wed May 15 11:11:51 CEST 2013


Hi Peter,

Thanks for your reply.
But does it mean that we can't use ZeroMQ/JZMQ in Android?

As per your suggestion, I also used the JeroMQ from
https://github.com/zeromq/jeromq

i used the source code of this JeroMQ in my Android app. When I compile my
code it get successfully compiled. I am able to get the ZMQ version. But
when  i tried to run this part of code
ZMQ.Socket socket = context.socket(ZMQ.REQ);
           socket.connect ("tcp://localhost:5555");

I am getting a runtime exception.
On debugging I found that  on the following line of code JeroMq throws
exception.
SocketBase.java
public boolean connect (String addr_)
{...
 paddr.resolved().resolve (
                address, options.ipv4only != 0 ? true : false);
                ...
                }

Please suggest what I can do to resolve the issue.
Thanks
Ranjeet Kumar


On Wed, May 15, 2013 at 1:02 PM, Pieter Hintjens <ph at imatix.com> wrote:

> Hi Ranjeet,
>
> You may find it easier to use JeroMQ, which is pure Java ZeroMQ stack
> and fully compatible.
>
> -Pieter
>
>
>
> On Wed, May 15, 2013 at 9:14 AM, Ranjeet Kumar <xs2ranjeet at gmail.com>
> wrote:
> > Dear Sir
> >
> >  I am trying to use the ZeroMQ-Jzmq in my Android project.
> > I had followed the all steps suggested in
> > http://www.zeromq.org/build:android.
> > I had successfully created the zmq.jar and libjzmq.so on the fedora linux
> > os.
> >
> > But when I use these in my Android application I am getting following
> error.
> >
> >
> > 05-15 12:26:15.034: I/dalvikvm(781): Could not find method
> > org.zeromq.ZMQ.getVersionString, referenced from method
> > com.example.zmq2test.MainActivity.onCreate
> > 05-15 12:26:15.054: W/dalvikvm(781): VFY: unable to resolve static method
> > 3570: Lorg/zeromq/ZMQ;.getVersionString ()Ljava/lang/String;
> > 05-15 12:26:15.054: D/dalvikvm(781): VFY: replacing opcode 0x71 at 0x000a
> > 05-15 12:26:15.114: D/AndroidRuntime(781): Shutting down VM
> > 05-15 12:26:15.124: W/dalvikvm(781): threadid=1: thread exiting with
> > uncaught exception (group=0x40a71930)
> > 05-15 12:26:15.155: E/AndroidRuntime(781): FATAL EXCEPTION: main
> > 05-15 12:26:15.155: E/AndroidRuntime(781):
> java.lang.NoClassDefFoundError:
> > org.zeromq.ZMQ
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > com.example.zmq2test.MainActivity.onCreate(MainActivity.java:15)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.app.Activity.performCreate(Activity.java:5104)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> >
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> >
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.app.ActivityThread.access$600(ActivityThread.java:141)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.os.Looper.loop(Looper.java:137)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > android.app.ActivityThread.main(ActivityThread.java:5041)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > java.lang.reflect.Method.invoke(Method.java:511)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> >
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
> > 05-15 12:26:15.155: E/AndroidRuntime(781):     at
> > dalvik.system.NativeStart.main(Native Method)
> >
> > Please help. I did lot of research on google from last  10 days.
> >
> > Thanks
> > Ranjeet Kumar
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130515/e49e3c99/attachment.htm>


More information about the zeromq-dev mailing list