Android Studio how to package single AAR from multiple library projects?

There is no mechanism to combine library. It’s a bit complicated as you probably want to control which dependencies get merged (for instance you probably don’t want to include support-v4 in there). Also you’d need to merge the resources and Android manifest.

At this time there’s no way to easily hack something, unless you are sure the resources have no conflicts between the two res folders (for instance you could have strings_a.xml in one lib and strings_b.xml in the other lib). This way you can just “merge” the two res folders by copying them both into the same location (as opposed to do a merge at the android res level).

For the Manifest it’d be more complicated, but doable with some custom code.

Providing a built-in mechanism for this is very low on our priority so don’t expect it anytime soon.

Leave a Comment