如何在另一个库中包含一个Android库模块?

问题描述:

我正在构建一个打包为aar并分发给第三方开发人员的Android库.

I am building an Android library that is packaged as an aar and distributed to 3rd party developers.

结构非常简单:

项目 -图书馆A --- libraryB

project ---libraryA ---libraryB

libraryA需要libraryB,这就是为什么它在gradle文件中有这个东西:

libraryA requires libraryB, which is why is has this in its gradle file:

compile project(':libraryB')

settings.gradle有

And settings.gradle has

include ':libraryB', ':libraryA'

但是,如果我以aar的形式构建项目,则它仅包含libraryA.我想念什么?

But if I build the project as an aar it only includes libraryA. What am I missing?

我阅读了对此的回复:

I read the responses to this: Android Studio how to package single AAR from multiple library projects?

这仍然不可能吗?我认为将您的代码分成多个模块不是一个坏习惯吗?

Is this still not possible? I would assume that splitting up your code into multiple modules is not bad practice?

您可以尝试在此处发布的fat-aar.gradle脚本: https://github.com/adwiv/android-fat-aar

You can try fat-aar.gradle script published here: https://github.com/adwiv/android-fat-aar