问题
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:
- Will everyone who will use my library need to add dependencies according to the library's dependencies (universal image loader, ORMLite, guava...)
- Do I need to create a separate aar for 'library B', and have users of my lib have a separate dependency for it?
回答1:
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.
回答2:
You don not need do that,and you only do the next: if you aar libray have thirty dependencies: you should make others use your aar library in the way: for example:
compile('com.android:com.android.download:1.3')
or
compile('com.android:com.android.download:1.3@aar'){
transitive = true
}
if your aar libray have not thirty dependencies:
compile('com.android:com.android.download:1.3@aar')
In a word:@aar have conflict with the default vault of transitive
来源:https://stackoverflow.com/questions/27890037/packaging-android-aar-that-has-dependencies