当前位置:网站首页>解决:Direct local .aar file dependencies are not supported when building an AAR.
解决:Direct local .aar file dependencies are not supported when building an AAR.
2022-07-28 21:54:00 【锐湃】
ndroid Studio 4.0+版本在打包过程中抛出以下异常
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 :XXXXXXXXXX
解决方案如下:
1.新建一个module,主要保留build.gradle文件(其他文件可以删掉)
2.将“The following direct local .aar file dependencies of the :”后提示的aar文件放到新建的module的根目录中,module目录结构如下:

3.修改build.gradle文件内容,如下:
configurations.maybeCreate("default")
artifacts.add("default", file('xxxx.aar'))
// 如有多个aar,只需要再次add
//artifacts.add("default", file('xxxx2.aar'))
//......
//artifacts.add("default", file('xxxxn.aar'))
4.将原aar的module去以module的形式依赖新module,依赖形式为 compileOnly,如下:
dependencies {
...
compileOnly project(path: ':newmodule')
...
}
5.再次打包即可
————————————————
版权声明:本文为CSDN博主「sayhello_class」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sayhello_class/article/details/123047897
边栏推荐
- Mongodb index add, view, export, delete
- Custom MVC principle and framework
- (22) two permutation (DP), package delivery (greedy)
- Design idea of room inventory in hotel reservation system database
- Function function
- 深度剖析集成学习Xgboost(续)
- Object object
- 【CNN】为什么CNN的卷积核大小一般都是奇数
- 金仓数据库 KingbaseES与Oracle的兼容性说明(2. 数据类型)
- 可视化全链路日志追踪
猜你喜欢
随机推荐
How to embed AI digital human function in VR panorama? Create a cloud experience
KingbaseES客户端编程接口指南-ODBC(4. 创建数据源)
【自】-刷题-峰值
Learn browser decoding from XSS payload
XML modeling
Plato Farm有望通过Elephant Swap,进一步向外拓展生态
trivy【2】工具漏洞扫描
Function function
智能电视与小程序的结合
2022G3锅炉水处理考试模拟100题模拟考试平台操作
Typescript prevents base classes from being instantiated
CV目标检测模型小抄(2)
Object object
猿人学第二十题
Fundamental inquiry binary tree
My second uncle is angry and swipes the screen all over the network. How can he cure my spiritual internal friction?
金仓数据库 KingbaseES与Oracle的兼容性说明(2. 数据类型)
Custom MVC principle and framework
Xss.haozi.me range details
【CNN】为什么CNN的卷积核大小一般都是奇数




![Trivy [2] tool vulnerability scanning](/img/7a/c1012c75b23076f5a9b09e5756adba.png)




![[self] - brush questions BFS](/img/e9/e90557c63c217a43c6a5d9de0d0869.png)