IntelliJ IDEA 12.1.0 Web Help

10.0+

IntelliJ IDEA supports Android library projects that hold shared Android source code and resources. Other Android application projects can reference a library project and include its compiled sources in their .apk files at build time.

In IntelliJ IDEA, library projects are supported through separate library modules. To use a library module in another IntelliJ IDEA project, import the required library module in the target project.

To enable sharing Android source code and resources, do one of the following:

In this topic:

To create a Library module
  1. Do one of the following:
  2. If you are creating a project from scratch, specify the common project settings.
  3. Specify the name of the application and the destination package to store the application classes in.
  4. Click Finish.
To update the Android facet of a module
  1. Open the settings of the module with contents to be shared.
  2. Click the Android facet node.
  3. On the Android Facet page, select the Library project check box.
To use a library module in another project
  1. On the main menu, choose File | New Module.
  2. On the first page of the Add Module wizard, choose the Import existing module option, and click Next.
  3. In the dialog that opens, specify the fully qualified name of the module file (*.iml), and click Finish.
  4. Add dependencies on the imported library module to the modules where you want to use its data:
    1. Open the settings of the required non-library module (File | Project Structure | Modules - required module).
    2. In the Dependencies tab, click the Add button add.png, then choose Module Dependency on the context menu.
    3. In the Choose Modules dialog box that opens, select the imported library module from the list.
    4. Click OK to return to the Project Structure dialog box. Confirm the added dependency by clicking OK.

See Also

Concepts:

Procedures:

Reference:

External Links:

Web Resources: