Creating multiple projects in Android Studio
What I want to do:
Create three Android projects in android studio
1) Shared project or library project (this is an independent project)
2) Project1 which uses the library project
3) Project2 which uses the library project
What is the problem?
This is easily possible in eclipse, but not in android studio. I cannot open three projects in one window in android studio. I tried to achieve this with modules, but it doesn't fit my requirements, it just adds the module to an existing project and has a circular dependency issue.
What have I tried?
1) http://www.philosophicalhacker.com/2014/10/02/an-alternative-multiproject-setup-for-android-studio/
- This is a long manual process and Android Studio does not support it directly.
2) Modules - One adds modules to an existing project Please help me. I am brand new to android studio.
source to share
You cannot have multiple projects in the same window in Android Studio. But you can create two projects and share a shared library.
In settings.gradle
the add project
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 shared library will be added as a module to both projects. Any changes made to this library will be displayed in both windows
source to share
You can create two flavors of your first project ie flavor 1 and flavor 2 using different / shared or shared codebases, resources, settings or configurations.
Gradle Build system uses build variant and product combination to create various applications with shared / shared base and code resources.
According to android developer site:
The build system uses products to create different versions of your application's product. Each version of your app may have different features or device requirements. The build system also uses build types to apply different build and packaging settings for each version of the product. Each combination of product flavor and assembly type represents an assembly option. The build system generates a different APK for each build option for your application. You can now have two or more flavors of a product, for example (paid flavor, free / demo flavor), etc. For one project with the same code base.
For more information see "Variants and Product Build Variants" Doc
source to share