Reputation: 1206
I can't compile the project anymore when I add the following dependencies
dependencies {
...
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.2'
...
}
to the project as suggested on the paho eclipse website:
https://www.eclipse.org/paho/clients/android/
I get following errors:
Duplicate class androidx.collection.LruCache found in modules collection-1.0.0.jar (androidx.collection:collection:1.0.0) and jetified-support-v4-r7.jar (com.google.android:support-v4:r7)
Duplicate class androidx.core.accessibilityservice.AccessibilityServiceInfoCompat found in modules core-1.0.1-runtime.jar (androidx.core:core:1.0.1) and jetified-support-v4-r7.jar (com.google.android:support-v4:r7)
Duplicate class androidx.core.app.ActivityCompat found in modules core-1.0.1-runtime.jar (androidx.core:core:1.0.1) and jetified-support-v4-r7.jar (com.google.android:support-v4:r7)
and many more others duplicate class errors. My project setup is quite basic because I just started.
So practically if you open a new project and add those dependencies you should get the same error as I did.
Why is that?How to solve this?
P.S.: I already cleaned, rebuilt, Invalidated caches and restarted, updated Android studio etc..
Nothing, I'm missing something else here.
Upvotes: 0
Views: 602
Reputation: 133
Late, but for future people who run into this problem:
Replace the Paho dependencies with this:
implementation'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.4'
implementation'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
Looks like a bug in the old versions.
Upvotes: 1
Reputation: 1206
I downloaded the paho mqtt jar file from https://mvnrepository.com/ and inserted it into the project without going through gradle and it works.
Maybe someone knows why inserting the dependencies in the gradle file as showed in my question leads to compilation errors.
Upvotes: 0