如何在gradle中添加Android归档的传递依赖项(How to add transitive dependencies of Android archive in gradle)

系统教程 行业动态 更新时间:2024-06-14 16:59:47
如何在gradle中添加Android归档的传递依赖项(How to add transitive dependencies of Android archive in gradle)

在我们公司,我们已经开始模块化我们的android项目,每个项目都有几个依赖项。 我们使用JFrog artifactory来托管我们的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问题,但是没有一个问题可以解决这个问题。 我还在其pom.xml文件中列出了LibraryA的所有依赖项。

At our company, we have started modularizing our android projects and each has several dependencies. We use JFrog artifactory to host our aar files. Here is the code:

Library A:

compile "com.google.firebase:firebase-crash:$googlePlayServices" compile "com.google.firebase:firebase-core:$googlePlayServices" compile "com.squareup.retrofit2:retrofit:$retrofit"

The following does not work. I have also tried removing "@aar" but still nothing. Main Projects:

compile ('com.sample.librarya:librarya:0.0.1@aar'){ transitive = true }

and hence I have to add retrofit dependencies to the main app again.

I have done a lot of research and read a lot of SO questions but none of them help hence this question. I also have all dependencies on LibraryA listed in its pom.xml file.

最满意答案

添加以下两个依赖项:

compile ('com.sample.librarya:librarya:0.0.1@pom') compile ('com.sample.librarya:librarya:0.0.1@aar')

第一个将下载pom并在classpath上添加它的所有传递依赖项。 第二个将下载aar。

Add both following dependencies:

compile ('com.sample.librarya:librarya:0.0.1@pom') compile ('com.sample.librarya:librarya:0.0.1@aar')

The first will download the pom and add all it's transitive dependencies on classpath. The second will download the aar.

更多推荐

本文发布于:2023-04-17 08:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/6fa27b3cf40b8d9628f5d37c102ad6e1.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Android   gradle   add   dependencies

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!