Currently i'm writing a library for android that needs Volley to function. Currently, the Volley dependency is declared in both the dependencies block for the library and whatever app uses the library. What do I need to do so that my Library can pull in its needed dependencies itself, instead of having the implementing app also declaring the dependency?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Gradle supports transitive dependencies.
For a local library, this works like this:
compile(project(:LIBRARY_NAME)) {
transitive=true
}
For remote libraries:
compile ('com.somepackage:LIBRARY_NAME:1.0.0'){
transitive=true //default, normally no need to specify explicitly
}