构建Android库时出错:不支持直接本地.aar文件依赖关系 [英] Error building Android library: Direct local .aar file dependencies are not supported

查看:13478
本文介绍了构建Android库时出错:不支持直接本地.aar文件依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近升级到了Android Gradle插件4.0.0-beta03.现在,在构建我们的库模块之一时会看到此错误

We recently upgraded to Android Gradle Plugin 4.0.0-beta03. We are now seeing this error when building one of our library modules

$ ./gradlew library_module:assemble

Execution failed for task ':library_module:bundleDebugAar'.
> Direct local .aar file dependencies are not supported when building an AAR. 
The resulting AAR would be broken because the classes and Android resources from any local .aar 
file dependencies would not be packaged in the resulting AAR. Previous versions of the Android 
Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The 
following direct local .aar file dependencies of the :library_module project caused this error: 
______.aar

我看到这是几个月前添加到AGP的 .但是他们没有提供更多原因的信息.

I can see this was added to AGP a few months ago. But they provide no further info on why.

所以

  1. 出了什么问题?还有更多信息吗?我在任何地方都找不到单个错误报告.
  2. 我究竟该如何解决?这是否表示我无法构建依赖于其他本地.aar的.aar?如果此本地Aar托管在Maven Central或另一个远程仓库中,该怎么办?为什么会有所作为?

推荐答案

我最近遇到了相同的问题,解决方法是从libs/中删除该库,并使用File -> New -> New Module -> Import .JAR/.AAR Package导入它,然后在库模块中对其进行引用build.gradle文件:

I recently encountered the same issue, the fix was to remove the library from libs/ and import it using File -> New -> New Module -> Import .JAR/.AAR Package, then referencing it in the library module build.gradle file:

dependencies {
  implementation project(":imported_aar_module")
}

这篇关于构建Android库时出错:不支持直接本地.aar文件依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆