gpt4 book ai didi

android - 如何使用组、名称、版本、类型的格式在 build.gradle 中添加 @jar 类型的依赖项?

转载 作者:太空宇宙 更新时间:2023-11-03 10:19:58 25 4
gpt4 key购买 nike

依赖的pom.xml用<packaging>apk</packaging>描述,这在编译中是行不通的。所以我排除了依赖树中的模块并重新包含 compile 'package:artifactId:versionName@jar'这确实有效,但是group:'groupName',name:'artifactId',version:'versionName',type:'type'的相应格式是什么? ?我试过 type:'jar'这没有用。我是否必须先排除依赖树中的依赖,然后再重新包含它?或者我可以修改父依赖的描述?

父依赖:

compile (group:'parentGroupId',name:'parentModuleName',version:'parentVersion'){
exclude group:'excludeGroupId',module:'excludeModuleName'
}

compile 'excludeGroupId:excludeModuleName:excludeVersion@jar'

我试过了

compile (group:'parentGroupId',name:'parentModuleName',version:'parentVersion'){
exclude group:'excludeGroupId',module:'excludeModuleName'
}

compile (group:'excludeGroupId',name:'excludeModuleName',version:'excludeVersion',type:'jar')

上面的没用

最佳答案

基于 http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html 上的文档这看起来像是指定这种依赖关系的正确方法:

compile (group:'excludeGroupId',name:'excludeModuleName',version:'excludeVersion') {
artifact {
name = 'excludeModuleName'
type = 'jar'
}
}

请注意,artifact 中的冗余 name 规范是必需的——如果没有它,您将得到一个 NullPointerException

关于android - 如何使用组、名称、版本、类型的格式在 build.gradle 中添加 @jar 类型的依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25305177/

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