I recognize the first one (
org.java-websocket:Java-WebSocket), as I happen to be using that on a project. The second one doesn’t even show up in a Google search, so I am uncertain where that is coming from.
You could run a Gradle dependency report. You get one by running the
dependencies Gradle task for your desired module, either from the Gradle tool in Android Studio (
dependencies is in the “help” category) or from the command line (e.g.,
./gradlew app:dependencies to run
dependencies for your
app module). That should help you identify where those two libraries are being pulled in.
In a recent question, you asked:
So then what is the exclude keyword used for?
This is a possible scenario for
exclude. Somebody repackaged
org.java-websocket:Java-WebSocket into their own artifact (
eu.electronicid.android:java-websocket), and it is unclear why. You can try choosing one of those two artifacts and using
exclude to block the other one. The good news is that this should eliminate the duplicate-class problem. The bad news is that if the classes are different between those two artifacts, you might have code that is depending on the one that you excluded. The only way to find out really is by thorough testing and see if you crash.