I am working on an internal library (name it "banana_lib"), which will be included in the Android application project. I want to provide this library to the client as an .aar file.
My library depends on another library (say Gson). If I can do this, I want to avoid combining the classes of this dependency into my library (the “thick jar”, “uber jar” approach).
I know that I can ask a user of my library to include dependencies in the build.gradle file of the application:
dependencies { compile 'com.google.code.gson:gson:2.2.4' compile files('libs/banana_lib.aar')
}
But I don’t want to burden the library user with including the dependencies of my library in the build.gradle file of the application.
Question: Is there a way to make gradle automatically resolve / enable dependencies of a .aar file? How can this be done so that the user of the .aar library has minimal effort? Do I need to provide a couple of .aar and .pom files? My main goal here would be to reduce what the user of this library should do. I feel that the library should ideally define all its dependencies, and gradle should just allow them in the background.
Put it a little differently: is there a way to allow the client / user to include the (internal!) Library (which has external dependencies): 1.) add the .aar file to the assembly. 2.) including it in build.gradle.
If there are other solutions that save the amount of work that the user / switch of the library should do with a minimum, then this would be interesting as well :)
Thank you very much!
source share