2

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-

  1. 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?]
  2. 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?

asked Jun 12, 2023 at 8:58
0

1 Answer 1

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.

answered Jun 12, 2023 at 9:03
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the answer. But wouldn't it EXCLUDE the dependency of the library. If it does so then that library won't work. Because the other duplicate class is from other library and has different code in it.
please try it out. you will see if it still works :)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.