Hello everyone, I have a question regarding Libra...
# android
s
Hello everyone, I have a question regarding Library Modularization. I am working on an Android Library Project where I am trying to split the main library into multiple modules( core, registration/login modules, and other library modules) and then adding the multi module library as one to receiving apps. I read that there are limitations in adopting this approach, can anyone suggest how this can be best achieved? Thank you.
b
Usually you’d have a single .aar / .jar that is emitted as part of the build process. This means your modularization efforts will be good for developing the library but not for consumption.
If you want on the other hand have multiple libraries that can be used in different feature modules using the com.android.dynamic-feature plugin, I recommend creating multiple libraries.
s
So you mean thst for my context keeping it as a Single Library module is more appropriate? My goal is to ship this project ad one library for consumer apps
b
You can still modularize to make your internal builds faster and your code easier to maintain.
But eventually it’ll just be libraries depending on other libraries.
k
I had similar case recently and unfortunately there is no official way to build single aar file from multi-module project. However there are third party solution called “Fat aar” like this one: https://github.com/kezong/fat-aar-android but, as I said, it’s not official tool and there can be some problems (that I’m facing right now to be honest)
s
@Ben see, I have so far split the project into 2 feature modules and 2 library modules(core and common) and they are then referenced in a base library module ==> one aar for the consumer app. I expect the problem to be that the aar will not have all dependenz libraries in it. Linking this all together seems more difficult than in an app modularization context.
@KamilH thanks for the info, i will check the referenced links.