Can we have multiple apps in one Android Studio project?

Yes, you have two options:

Option 1: Create an addition app module

  1. First create your standard Phone & Tablet Android project, including the auto-generated app module.
  2. Add a new app module: File > New > New Module … > Phone & Tablet Module
  3. Complete the wizard and name your Application app2 for instance.

Now you’ll have both app and app2 in the same project.

To actually run app2 you first need to select it in the pull-down menu in the top toolbar of Android Studio, next to the Start and Debug icons. You can also do this though Run Configurations: Run > Run… > Edit Configurations… and modifying Module.

Option 2: Create an addition library module

This is ideal for creating a separate library that is isolated from the app, and can be shared across more apps (or other projects):

  1. Add a new library module: File > New > New Module … > Java Library.
  2. Complete the wizard and give your library a good name, like libgoodstuff.

Now libgoodstuff and app will reside in the same project.

To make app sources depend on libgoodstuff, you first have to add the library module to the project settings.gradle to look something like this:

include ':app', ':libgoodstuff'

Then in app/build.gradle you have to depend on the library module like this:

apply plugin: 'com.android.application'

···
dependencies {
    ···
    implementation project(path: ':libgoodstuff')
    ···
}
···

Leave a Comment