Abhishek Batra
Abhishek Batra

Reputation: 1599

Dependency in Android Library Module

I am working on a Android Library. I need to use various open source libraries like volley, socket.io etc. Should I add dependency in build.gradle file or Should I include the source code as a package in my library module ?

Since Volley and Socket.io are pretty common libraries, I want to avoid any type of conflict in the future? It should work well under following coditions.

  1. User adds the same library (jar, gradle dependency)
  2. Difference in version added by user (say Volley, included is 1.0, and user adds 1.2).

I need to export the library to jCenter;

There aren't much resources available, the one which are available, are complex.

Upvotes: 1

Views: 134

Answers (1)

Eugen Martynov
Eugen Martynov

Reputation: 20130

If you want that your library uses specific version all the time then you should include dependencies by sources and rename packages to avoid dex issues for clients if they going to use same library.

I would still state dependencies in build.gradle and allow client of the library to decide about dependency conflict resolution

Upvotes: 1

Related Questions