Create multiple projects in Android Studio

馋奶兔 提交于 2019-12-06 09:33:18

You can't have multiple projects in a single window in Android Studio. But you can create two projects and share the common library.

In settings.gradle of project add

include ':commonLibrary'
project(':commonLibrary').projectDir= new File('../path_to_your_library_module')

In build.gradle add compile project(':commonLibrary').

Do this in both projects and the common library will be added as module in both projects. Any changes you make in this library will reflect in both windows

You can create two flavors of your Main Project i-e flavor 1 and flavor 2 with different/shared or common codebase,resources,settings or configurations.

Gradle Build System uses a Build Variant and combination of product flavors to generate different apps with shared/common code base and resources.

As per Android Developer Reference Site:

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. Now one can have two or more product flavors e.g (paid flavor, free/demo flavor) etc for one single project with same code base.

For more information See Build Variants & Product Flavors Doc

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