83

I have downloaded Android Studio and started using it for my Android development.

I need to know, how to open multiple number of projects in a single window like Eclipse. Expecting some help, thanks.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
SelvaMariappan
  • 1,334
  • 2
  • 11
  • 20

3 Answers3

59

IntelliJ IDEA creates a project for the entire code base you work with, and a module for each of its individual components. So, IntelliJ IDEA module is more like an Eclipse project, and project is roughly similar to Eclipse workspace. There's no exact equivalent to Eclipse's workspace that contains all your work, but you can open multiple projects in multiple frames at the same time.

This table can help you see how Eclipse and IntelliJ IDEA concepts map to each other:

Eclipse               IDEA
Workspace             Project
Project               Module
Project-specific JRE  Module JDK
User library          Global library
Classpath variable    Path variable
Project dependency    Module dependency
Library               Module library

To use the library add it as a dependancy:

File > Project Structure > Modules > Dependencies

Then add the module (android library) as a module dependency.

Chris
  • 1,311
  • 2
  • 15
  • 37
  • 7
    That is not true. A project in IDEA is not like a workspace. Think about this: you set the minSDK, target and maxSDK to the project, it has some configuration for the project. But the workspace dont have any configuration. The project is just a project, but can have multiple packages like in eclipse. That's all. – Sterling Diaz Feb 18 '14 at 20:59
  • 2
    @Sterling Diaz That is pretty much true actually. You can set separate 'min-' and 'target' sdk level for every module in its build.gradle file and don't set any at all for Project in whole - like you said for Workspace. Even more, you can set 'version' and whatever-you-want properties to every module and compile them separately. So Project is pretty much like Workspace, nobody says it is exactly the Workspace. – mykolaj Feb 17 '15 at 06:54
  • 4
    Incredibly useful post. Very confusing that a project in Eclipse is roughly equivalent to a module in IDEA. It would be a very nice feature to have multiple projects open in IDEA at one time. I have a set of Java libraries, Android libraries and several apps based on one or both. Each app has a free, paid and common module. It would be nice to view the libraries and each app together. Maybe a future enhancement? – Dustin Mar 27 '15 at 19:28
  • But if you import a module, you copy the code (correct me if Im wrong). That means changes applied to the module are not applied to the same module imported in another project? – 最白目 Aug 02 '17 at 06:20
  • (I tested it and it is like I assumed). In eclipse`s workspace, the project would point to the same source. No offense, but it´s just not true what you write. – 最白目 Aug 02 '17 at 06:38
34

Open two projects in a single window is not possible in Android Studio / IntelliJ IDEA. So, when you open a second project, you'll have to decide:

New projects can either be opened in a new window or replace the project in the existing window. How would you like to open the project?

This limitation is useful because your window offers project specific features, like the Changes tab for VCS information, etc.

How to use library projects?

For now, you can copy the library project into your project folder and declare it as a module dependency. If you use the same libraries in different projects, you will end up having the code multiple times.

ProjectA                   ProjectB
 facebook-sdk/              actionbarsherlock/
 actionbarsherlock/         bin/
 bin/                       src/
 src/                       ...
 AndroidManifest.xml

While this feels kind of inconvenient, it helps having all the required sources in VCS. Soon, Gradle, the new build system, will manage these dependencies pleasantly. Here's an example of how the Gradle build could look like to include ActionBarSherlock or similar libs:

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.actionbarsherlock:library:4.2.0'
}

In this answer you'll find some reasons why this solution does not work yet.

Community
  • 1
  • 1
ottel142
  • 2,016
  • 1
  • 26
  • 37
  • thanx for u answer .if refer library project how can import it in same window – SelvaMariappan May 20 '13 at 09:17
  • 5
    @ottel In eclipse we can see two or more projects in project explorer but android studio we cannot see. Why android developer at google is not thinking about with Android studio so developer life can be easier instead of harder. – Arun Kumar Mar 08 '15 at 03:14
  • This option seems to have been removed in Android Studio 2.0+ – Essej May 04 '16 at 06:10
1

write code in settings.gradle

include ':ProjectName'
project(':ProjectName').projectDir = new File(rootDir, '/ProjectName')
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Suresh Sarak
  • 119
  • 1
  • 1