dors dors - 1 month ago 10
Android Question

Packaging Android AAR that has dependencies

I want to package my library as an aar.

The library has several dependencies (universal image loader, ORMLite, guava...)

It also has a dependency for another library that I wrote (call it 'library B').

I have 2 questions:


  1. Will everyone who will use my library need to add dependencies according to the library's dependencies (universal image loader, ORMLite, guava...)

  2. Do I need to create a separate aar for 'library B', and have users of my lib have a separate dependency for it?


Answer

Will everyone who will use my library need to add dependencies according to the library's dependencies (universal image loader, ORMLite, guava...)

Not if you are distributing your AAR as an artifact in a repository with appropriate metadata (e.g., Maven-style POM file). The metadata will point to your dependencies, and build systems (e.g., Gradle) will pull in the dependencies.

Do I need to create a separate aar for 'library B'

Yes, otherwise nobody will have access to it, unless you eliminate it and fold its code into your first library.

and have users of my lib have a separate dependency for it?

See above for setting up dependencies.