Android modules vs Flavor

天涯浪子 提交于 2021-01-29 14:59:46

问题


I'm searching for differences between modules and flavor.

I've read those posts:

  • Android difference between module vs flavor
  • When to use android flavours vs separate projects

But it's still a bit blur about the differences and how to choose between one and another.

So far the only differences, I manage to get out of it is:

  • Different structure

Modules can do everything that a Flavor does.

My first question is, what's the difference and what's so good about flavor that you don't use modules ?

Also, is flavor adapted for 2 applications where Application-1 and Application-2 share same code base (i.e. API, models, utils, service), but deviate from each other in terms of features and UI?


回答1:


When to use modules:

When your project can be separated into smaller independent parts.

I've don'e this to my project, and my compile time went from 50+ seconds per iteration to less than 10 per iteration.

Because when I change code in 1 module, the others dont change and that's why the compile time is faster.

When to use flavours:

  1. When you want to publish apps to different stores, and they need to have different applicationId

for example you want to publish to google play, and amazon store, and some other store that no one has heard of.

  1. When you want to have part of your app available under certain build time conditions

  2. When you want to whitelabel your app - basically it has the same logic but different UI, so in practice it is a completely different app, only... it's not.



来源:https://stackoverflow.com/questions/60385546/android-modules-vs-flavor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!