admin管理员组文章数量:1590157
用新AS打开老项目是遇到一个这样的报错,新建一个项目来测试一下
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 :aartest project caused this error:
第一步 新建module-》build.gradle 文件改成这样(新建的module多余的东西删掉保留build.gradle)
将aar文件移到和图里一样的地方,然后build.gradle文件修改成如下代码(名字自己换,原来的arr删除掉,移到这里)
configurations.maybeCreate("default")
artifacts.add("default", file('alipaySdk.aar'))
在你要引用aar的module里
api project(path: ":arrDir")
我这里app还需要依赖arrtest模块 ,arrtest里用api 这样app也可以用alipaySdk.aar ,app依赖如下
implementation project(path: ':aartest')
最后别忘了在 setting.gradle加入include ':arrDir' (一般会new module的时候自动添加)
(我是Gradle7.0版本)
版权声明:本文标题:搞定Direct local .aar file dependencies are not supported when building an AAR.把AAR以module方式加入 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728084246a1144797.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论