Android release packaging error solution Direct local .aar file dependencies are not supported when building an AAR

Make a note, when the release compiles the Android apk, it reports the Direct local .aar file dependencies are not supported when building an AAR error, the environment is like this, a module module is built under a main project, and this module module is introduced I installed a third-party *.aar package. Maybe because the gradle version is relatively new. I used the 7+ version, and the direct run installation was fine, but the release package failed. The error report said that the aar might be damaged, so I found the following method

  • module module

原来把aar扔到libs下,直接这样引入
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

把他改为
compileOnly fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

  • main project
module的libs下的aar拷贝一份到主项目libs
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

The key operation is to change the implementation of the module to compileOnly

At this point you will find that the package is successful!

Guess you like

Origin blog.csdn.net/Janix520/article/details/125040910