Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a "Library Project" in IntelliJ IDEA?

Tags:

I'm using ActionBarSherlock in an Android project that I developed using Eclipse. I'd like to migrate that project over to IntelliJ IDEA, but I'm not sure how to add a "Library Project" to IDEA.

Is this a feature IDEA supports? If so, can someone help me figure out how to add one?

Thanks!

UPDATED: What I'm referring to is what they describe here -- Managing Projects from Eclipse with ADT. They allow you to add a reference to an uncompiled project as a "library."

like image 364
Marc Chambers Avatar asked Jan 16 '12 18:01

Marc Chambers


People also ask

How do I create a library project in IntelliJ?

From the main menu, select File | Project Structure | Project Settings | Modules. Select the module for which you want to add a library and click Dependencies. button and select Library. In the dialog that opens, select a project or a global library that you want to add to the module.

How do you add a library to a project?

Right-click the Java project to which you want to add a library, and select Properties from the menu. Select Java Build Path, and click the Libraries tab. Click the Add Library button, and choose the appropriate Java EE Library. Click Next to view the library contents, and click Finish.

How do I add an existing project to IntelliJ?

Otherwise, from the main menu, select File | New | Project from Existing Sources. In the dialog that opens, select the directory in which your sources, libraries, and other assets are located and click Open. Gradle or Android Gradle: select the necessary build tool and click Finish.


2 Answers

You need to create a new IDEA module from the existing source code. Ensure that Android facet is enabled for this module, in the facet settings you need to enable "Is Library Project" option. Then add this module as a dependency to your main module.

like image 167
CrazyCoder Avatar answered Sep 25 '22 15:09

CrazyCoder


For new visitors:

Create a module from existing sources (point to the library directory inside ABS), then add android-support-v4.jar as a dependency to your project and ABS modules.

There's also a detailed tutorial.

like image 44
Jamol Avatar answered Sep 22 '22 15:09

Jamol