問題描述
關于 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:
來自遠程存儲庫的傳遞 AAR 依賴關系被簡單地破壞了
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,兩者都在同一個遠程存儲庫中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!