Simot00
Simot00

Reputation: 1

Error:Execution failed for task when using MQTT dependencies ...paho.android.service:1.0.2

I have just started using MQTT protocol with Android Studio. Using mosquitto broker. The app built successfully with Android Studio if i remove this dependience from grandle : compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.2 , but the app dosn't start.

When i compile including the string : complile 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.2' the errore is :

*Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;*

I tried many different alternatives but no one worked good. I have no any ideas

Upvotes: 0

Views: 201

Answers (1)

wyzard
wyzard

Reputation: 553

Try to modify your app's build.gradle file (dependencies section) like this:

compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
    exclude module: 'support-v4'
}

The error is throwing (maybe) because you are trying to 'include' the support-v4 module more than once.

Upvotes: 1

Related Questions