引用: implementation files("lib/libs-release.aar")
build失败:
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 :ui project caused this error: G:\TESTNewCode\TestApp\ui\lib\libs-release.aar
修改:
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
这种依赖问题应该是由于环境版本变化导致的,根据错误描述说以前的这种直接依赖方式会破坏aar文件,高版本后不再支持,我们这种解决方式是让library在编译时使编译器通过不报错,在主工程拷贝一份的文件在打包后能让程序正常调用
文章讲述了在构建AAR时遇到直接依赖本地aar文件导致的构建错误。错误提示表明,直接依赖aar文件在新版本的AndroidGradlePlugin中不被支持,因为这会导致生成的AAR文件损坏。为了解决这个问题,文章建议使用fileTree方法,将aar和jar文件包含在libs目录下,以便在编译时不报错且能正确打包资源。
3833

被折叠的 条评论
为什么被折叠?



