In my project there are two different external libraries
// TheoPlayer Android SDK
implementation ':theoplayerApi21@aar'
// Pushly notification SDK
implementation 'com.pushly.android:pushsdk:1.1.9'
when I tried to run the app I get following error:
Duplicate class a.a found in modules jetified-pushsdk-1.1.9-runtime (com.pushly.android:pushsdk:1.1.9) and jetified-theoplayerApi21-runtime (:theoplayerApi21:)
Duplicate class b.a found in modules jetified-pushsdk-1.1.9-runtime (com.pushly.android:pushsdk:1.1.9) and jetified-theoplayerApi21-runtime (:theoplayerApi21:)
Duplicate class c.a found in modules jetified-pushsdk-1.1.9-runtime (com.pushly.android:pushsdk:1.1.9) and jetified-theoplayerApi21-runtime (:theoplayerApi21:)
What I understood- both the libraries are trying to obfuscate their classes, but they are giving same names to the package and classes.
When I searched for solutions- they say exclude the module but I would have to keep both classes as they are not old and new versions of same libraries. Both are different.
I guess the solution could be-
- to tell both libraries to respect each other's obfuscation and name properly [but I wonder why other external libraries are not in the list?]
- not allow one of the external library to obfuscate [but I am not using proGuard in my project]
I am trying to find out how to do it. Any suggestions?
1 Answer 1
You can just exclude one of duplicated lib from external dependency, something similar to this:
implementation ('com.pushly.android:pushsdk:1.1.9') {
exclude group: "your_duplicated_dependency", module: "your_module"
}
See how exclude works in gradle - click.