gpt4 book ai didi

android - 如何将android gradle项目的依赖设置为不同版本的库?

转载 作者:行者123 更新时间:2023-11-30 01:35:16 25 4
gpt4 key购买 nike

我有一个小型日志库,它发布到 jcenter。我需要有两个版本的库 - 调试和发布。为此,我找到了标记 publishNonDefault true 并推送了新版本的库。

设置标志之前存储库中的文件结构: 1.2.4设置标志后存储库中的文件结构: 1.3.1

现在
依赖项{
编译'me.shikhov:wlog:1.3.1'
}

给我错误

Error:A problem occurred configuring project ':Project'.
Could not find wlog.jar (me.shikhov:wlog:1.3.1).
Searched in the following locations:
https://jcenter.bintray.com/me/shikhov/wlog/1.3.1/wlog-1.3.1.jar

我找到了本地依赖的语法,例如:

debugCompile project(path: ':myLocalLibrary', configuration: 'debug')

releaseCompile project(path: ':myLocalLibrary', configuration: 'debug')

如何设置远程库依赖?

最佳答案

Artifact 名称中版本之后的额外字符串是分类器。

The classifier allows to distinguish artifacts that were built from the same POM but differ in their content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number. As a motivation for this element, consider for example a project that offers an artifact targeting JRE 1.5 but at the same time also an artifact that still supports JRE 1.4. The first artifact could be equipped with the classifier jdk15 and the second one with jdk14 such that clients can choose which one to use.

Another common use case for classifiers is the need to attach secondary artifacts to the project's main artifact. If you browse the Maven central repository, you will notice that the classifiers sources and javadoc are used to deploy the project source code and API docs along with the packaged class files.

来自 here .

Gradle 依赖声明采用以下形式:

[organisation]:[module]:[revision]:[classifier]@[ext]

所以你应该将依赖作为:

compile 'me.shikhov:wlog:1.3.1:release@aar'

关于android - 如何将android gradle项目的依赖设置为不同版本的库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35177822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com