1

I'm a newbie in programming Android APP. I'm using ActiveMQ running on Win7 as a Messaging Server. I'm trying to test Message-Oriented Middleware protocols such as MQTT, STOMP, etc. via Android APP.

I've import adroid-mqtt-demo repo's project to Eclipse to test MQTT connection, and include the java_1.4_uber.jar from mqtt-client. I encountered same problem with this issue.

So I tried to create a source folder /mqtt which is same level with /src under this project, and I copy-paste all the classes under /matt-client/src/main/java/org/fusesource/mqtt directory in the mqtt-client repo one by one. (very stupid, I know, but I don't know other way to achieve it.)

But when I ran this app on either on emulator or my android phone, it showed another errors, such as "error opening trace file", "Could not find class 'org.fusesource.hawbuf.UTF8Buffer'", and "java.lang.VerifyError: org/fusesource/mqtt/codec/CONNECT".

I've googled to find out the solution for many days, and still cannot find how to make it work. Could anybody give me some advices?

andRookie
  • 27
  • 4

1 Answers1

0

If you just want to run the demo you only need to download the uber-jar (as you already did) and then you need to 1) create a libs folder in your project's root folder 2) copy the jar file inside that folder and 3) right click on the uber-jar file, select Build Path > Add to Build Path.

The above is what user anandaverma describes here:https://github.com/jsherman1/android-mqtt-demo/issues/2

This should also be helpful: How can I use external JARs in an Android project?. As it is mentioned in one of the comments:

Note that when using recent Eclipse/ADT versions the external jars have to be in a folder called libs (instead of lib)

Community
  • 1
  • 1
zlinks
  • 1,037
  • 2
  • 16
  • 26