在我们公司,我们已经开始模块化我们的 android 项目,每个项目都有几个依赖项。我们使用 JFrog 工件来托管我们的 aar 文件。这是代码:
图书馆 A:
compile "com.google.firebase:firebase-crash:$googlePlayServices"
compile "com.google.firebase:firebase-core:$googlePlayServices"
compile "com.squareup.retrofit2:retrofit:$retrofit"
以下不起作用。我也尝试过删除“@aar”,但仍然没有。
主要项目:
compile ('com.sample.librarya:librarya:0.0.1@aar'){
transitive = true
}
因此我必须再次向主应用程序添加改造依赖项。
我做了很多研究并阅读了很多 SO 问题,但没有一个能帮助这个问题。我还拥有对 LibraryA 的所有依赖项,列在其
pom.xml
中。文件。
最佳答案
添加以下两个依赖项:
compile ('com.sample.librarya:librarya:0.0.1@pom')
compile ('com.sample.librarya:librarya:0.0.1@aar')
第一个将下载 pom 并将它的所有传递依赖项添加到类路径中。第二个将下载 aar。
关于android - 如何在 gradle 中添加 Android 归档的传递依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42355792/