ActiveMQ does not work in Android

I have an ActiveMQ consumer in an Android application, and I included activemq-all-5.9.0.jar in my project and set the build path, but my application doesn’t work for me at all. Below is my code.

        ActiveMQConnectionFactory connectionFactory = null;
        MessageConsumer consumer = null;
        Session session = null;
        Connection connection = null;

        connectionFactory = new ActiveMQConnectionFactory("failover:(tcp://xxx.xx.xx)?useExponentialBackOff=true&maxReconnectAttempts=-1");
        connection = connectionFactory.createConnection("xxx", "xxx");
        connection.start();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
        Topic  topic = session.createTopic("jms.topic.test");
        consumer = session.createConsumer(topic);

When the application starts, the following error message is displayed.

Dx problem handling "javax / management / j2ee / ListenerRegistration.class":

Explicit or erroneous use of the main class (java. * Or javax. *) When the main library is not built.

[2015-01-28 15:21:26 - MyApp] Error Dx 1; interrupt

[2015-01-28 15:21:26 - MyApp] Error converting to Dalvik format with error 1

How can I solve this problem and how to make the application work.

Please help me.

0
source share
1

Android J2EE javax.*, Oracle Java. : javax. * Android?.

ActiveMQ- Android ( ). MQTT, , .

, , / - , ( Android ).

+2

All Articles