Reputation: 297
I have an existing Android project that already has 2 product flavors. Each flavor is an individual android app that has a lot of common code.
Now we also need to build a library (AAR) from the same repo for distribution. We were able to do it by changing the Android Plugin from
apply plugin: 'com.android.application'
to
apply plugin: 'com.android.library'
The problem now is that I have to build both the apps and also this SDK from a single Android Project.
Let's consider the two apps are App-A and App-B, the SDK is using the common modules used by both the app and also some modules in the App-B.
Is there a way to make the SDK as a third flavor?
The plugin (Application or Library) is specified in the app-level build Gradle rather than in flavor level.
There is a way to make the common modules and modules used in the SDK as a library project and use it to build the Apps. But it requires a lot of code restructuring. So I will have to do it as a last resort.
Upvotes: 2
Views: 364
Reputation: 386
I think its highly recommended to keep your library code separate and have a separate build flavor for library.
1.Separate Library. 2.One Application with two different flavors to access required logic from library module.
So maintainability will be easy from here after.
Had followed this approach for one of our SDK project.
Upvotes: 1