android - mavenLocal 没有从 .m2 存储库中获取工件
问题描述
我已将 maven publish 添加到运行正常的库项目中,并且它正在 .m2/repository 中生成 .aar 文件现在我正在尝试将该库添加到我的应用程序项目中,但它给出了错误。
这是我的 build.gradle(app's)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:perf-plugin:1.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和 common.gradle (我在哪里实现了那个库)像这样
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Use project(":libraryName") if you need to test changes to library in development.
implementation project(":libraryName")
}
我得到的错误
ERROR: Unable to resolve dependency for ':mobile@prodDebugUnitTest/compileClasspath': Failed to transform artifact 'library.aar (project :libraryName)' to match attributes {artifactType=jar}.
解决方案
尝试包括*.aar
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
或者你可以像这样实现:
implementation "com.yourlibrarygroup.id:artifactoryname:0.0.1@aar"
推荐阅读
- json - 从文件读取配置时,Invoke-Command 失败并显示 $env 变量失败
- wordpress - 如何最好地实例化多个克隆站点并维护它们?
- ruby - 有条件地重启服务
- database - 实体关系图字段组合唯一性表示
- php - 如果密码包含在要解析的字符串中,Password_verify() 给出 true
- jboss - 使用 SPI 配置 Keycloak 提供程序
- tidymodels - 将 initial_time_split 与 drake 一起使用时出错
- laravel - Cpanel Laravel 软件包安装被“杀死”
- flutter - 如何用颤振在android中实现(完成)按钮
- python - 通过与其他列表中的列表匹配来过滤列表列表