Android Studio - Multiple android apps with common dependencies in a single project

后端 未结 1 1061
伪装坚强ぢ
伪装坚强ぢ 2021-02-20 11:27

I have two different android apps A and B. A and B are modules in the same project

Both have a dependency on a library module Z which itself depends on two other library

相关标签:
1条回答
  • 2021-02-20 12:08

    A single Android project can indeed have multiple apps, although you could argue about the benefits of having several apps in a single project if they are unrelated.

    Anyway, this is perfectly reasonable in case you have several versions of the same app with some differences among them (target devices, branding...). In that case the Gradle build system allows you to have build variants (each build variant being a combination of a product flavor and a build type). According to the official documentation (Configuring Gradle Builds > Work with build variants):

    The build system uses product flavors to create different product versions of your app. Each product version of your app can have different features or device requirements. The build system also uses build types to apply different build and packaging settings to each product version. Each product flavor and build type combination forms a build variant. The build system generates a different APK for each build variant of your app.

    0 讨论(0)
提交回复
热议问题