Gradle for Android AAR 取决于 AAR,两者都在同一个远程存储库中?

时间:2023-02-02
本文介绍了Gradle for Android AAR 取决于 AAR,两者都在同一个远程存储库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

关于 Gradle 中 AAR 文件的传递依赖关系存在一些问题:

There are a few questions floating around regarding transitive dependencies with AAR files in Gradle:

  • Android Studio 0.2.3 无法解析传递 aar依赖关系
  • Android Gradle 库依赖和使用 Nexus 的库依赖
  • 存储库中的 Aar.外部依赖和 NoClassDefFoundError

我在尝试在远程存储库中设置对 AAR 文件的传递依赖时也遇到了类似的问题.我有 App A,取决于库 B,而库 B 又取决于在库 C 上.库 C 位于 Maven 存储库中.库 B 在同一个仓库中,带有 POM包含对库 C 的依赖项.应用程序 A 在其依赖项中有库 B.但是,运行 gradle clean assembleDebug 会导致:模块版本 [库 B] 依赖于库,但本身不是库".

I too have run into similar problems trying to set up transitive dependencies upon AAR files in a remote repository. I have App A, depending upon Library B, which in turn depends upon Library C. Library C is in a Maven repo. Library B is in the same repo, with a POM that contains the dependency upon Library C. App A has Library B in its dependencies. However, running gradle clean assembleDebug results in: "Module version [Library B] depends on libraries but is not a library itself".

我试图悬赏其中一个问题,希望得到澄清,但没有运气.

I tried putting a bounty on one of those questions, hoping for clarity, with no luck.

我的猜测是,我和有上述 SO 问题的人看到的困难可能有两个来源:

My guess is that there are two possible sources of the difficulty that I and those with the aforementioned SO question are seeing:

  1. 来自远程存储库的传递 AAR 依赖关系被简单地破坏了

  1. Transitive AAR dependencies from a remote repository are simply broken

来自远程存储库的传递 AAR 依赖项工作,但在我们的 POM 文件、build.gradle 文件中存在一些问题,或者某些东西破坏了依赖项

Transitive AAR dependencies from a remote repository work, but there is something off in our POM files, build.gradle files, or something that is breaking the dependencies

问题:有人知道某个公共存储库(例如 Maven Central)中的 AAR 工件,它依赖于同样位于同一公共存储库中的另一个 AAR 工件吗?

The Question: Does anyone know of an AAR artifact in some public repository (e.g., Maven Central), that depends upon another AAR artifact, also in the same public repository?

我对依赖于本地存储库中某些内容的 AAR 不感兴趣,例如 Maven Central 中依赖于 com.android.support:support-v4 的 AAR.就我而言,如果库 B 和库 C 都在我的本地 Maven 存储库 (~/.m2) 中,则一切正常.

I am not interested in an AAR that depends upon something in a local repository, like an AAR in Maven Central that depends upon com.android.support:support-v4. In my case, if Library B and Library C are both in my local Maven repository (~/.m2), everything works fine.

根据 Xav,我正在做的事情应该有效.因此,我希望有人能给我指出一个可行的例子,以便我可以用它来确定我们其他人可能出错的地方.

According to Xav, what I am doing should work. Hence, I am hoping that somebody can point me to a working example, so that I can use it to determine where the rest of us may be going wrong.

注意:我知道要求异地资源是禁止的.在这种情况下,我不是在寻找资源本身,而是作为工作配置的示例,以帮助调试非工作配置.如果您有另一种写出显示工作配置的答案的方式,那就太棒了!

NOTE: I know that asking for off-site resources is verboten. In this case, I am not looking for the resource in its own right, but as an example of a working configuration, to help debug a non-working configuration. If you have another way of writing up an answer showing a working configuration, that'd be awesome!

谢谢!

推荐答案

Gradle 1.9 和 com.android.tools.build:gradle:0.7.+ 似乎解决了我的问题.至少,我无法再重现该问题.

It appears that my problem has cleared up with Gradle 1.9 and com.android.tools.build:gradle:0.7.+. Leastways, I can no longer reproduce the problem.

这篇关于Gradle for Android AAR 取决于 AAR,两者都在同一个远程存储库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:BuildConfig 未正确创建(Gradle Android) 下一篇:运行 gradlew 测试时 android 中的 Jvm 选项

相关文章

最新文章