diff --git a/docs/html/guide/developing/projects/index.jd b/docs/html/guide/developing/projects/index.jd index e27fcb43252e1..273a405e2b5d4 100644 --- a/docs/html/guide/developing/projects/index.jd +++ b/docs/html/guide/developing/projects/index.jd @@ -10,11 +10,13 @@ page.title=Managing Projects
  • Library Projects
      -
    1. Migrating library projects to ADT 0.9.8 or higher
    2. +
    3. Development considerations
  • Test Projects
  • + +
  • Testing a Library Project
  • @@ -210,6 +212,11 @@ page.title=Managing Projects and, at build time, include its compiled sources in their .apk files. Multiple application projects can reference the same library project and any single application project can reference multiple library projects.

    + +

    Note: You need SDK Tools r8 or newer to fully support library projects + for all Android platform versions. You can download the tools and platforms using the + Android SDK and AVD Manager, as described in + Adding SDK Components.

    If you have source code and resources that are common to multiple Android projects, you can move them to a library project so that it is easier to maintain across applications and @@ -262,84 +269,11 @@ page.title=Managing Projects the application. However, note that a library can import an external library (JAR) in the normal way.

    -

    Development requirements

    - -

    Android library projects are a build-time construct, so you can use them to build a final - application .apk that targets any API level and is compiled against any version of - the Android library.

    - -

    However, to use library projects, you need to update your development environment to use the - latest tools and platforms, since older releases of the tools and platforms do not support - building with library projects. Specifically, you need to download and install the versions - listed below:

    - -

    Table 1. Minimum versions of SDK tools and platforms on - which you can develop library projects.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ComponentMinimum Version
    SDK Toolsr6 (or higher)
    Android 2.2 platformr1 (or higher)
    Android 2.1 platformr2 (or higher)
    Android 2.0.1 platformnot supported
    Android 2.0 platformnot supported
    Android 1.6 platformr3 (or higher)
    Android 1.5 platformr4 (or higher)
    ADT Plugin0.9.7 (or higher)
    - -

    You can download the tools and platforms using the Android SDK and AVD Manager, as - described in Adding SDK Components.

    -

    Development considerations

    As you develop your library project and dependent applications, keep the points listed below in mind:

    - + - - - -

    Migrating library projects to ADT 0.9.8 or higher

    - -

    This section provides information about how to migrate a library project -created with ADT 0.9.7 to ADT 0.9.8 or higher. The migration is needed only if -you are developing in Eclipse with ADT and assumes that you have also upgraded -to SDK Tools r7 (or higher).

    - -

    The way that ADT handles library projects has changed between -ADT 0.9.7 and ADT 0.9.8. Specifically, in ADT 0.9.7, the src/ -source folder of the library was linked into the dependent application project -as a folder that had the same name as the library project. This worked because -of two restrictions on the library projects:

    - - - -

    In ADT 0.9.8, both of those restrictions were removed. A library project can -have as many source folders as needed and each can have any name. Additionally, -a library project can store source folders in any location of the project. For -example, you could store sources in a src/java/ directory. In order -to support this, the name of the linked source folders in the main project are -now called <library-name>_<folder-name> For -example: MyLibrary_src/ or MyLibrary_src_java/.

    - -

    Additionally, the linking process now flags those folders in order for ADT to -recognize that it created them. This will allow ADT to automatically migrate the -project to new versions of ADT, should they contain changes to the handling of -library projects. ADT 0.9.7 did not flag the linked source folders, so ADT 0.9.8 -cannot be sure whether the old linked folders can be removed safely. After -upgrading ADT to 0.9.8, you will need to remove the old linked folders manually -in a simple two-step process, as described below.

    - -

    Before you begin, make sure to create a backup copy of your application or -save the latest version to your code version control system. This ensures that -you will be able to easily revert the migration changes in case there is a -problem in your environment.

    - -

    When you first upgrade to ADT 0.9.8, your main project will look as shown -in figure 1, with two linked folders (in this example, MyLibrary and -MyLibrary_src — both of which link to -MyLibrary/src. Eclipse shows an error on one of them because they -are duplicate links to a single class.

    - - -

    Figure 1. Library project migration error

    -

    To fix the error, remove the linked folder that does not contain the -_src suffix.

    - -
      -
    1. Right click the folder that you want to remove (in this case, the -MyLibrary folder) and choose Build Path > -Remove from Build Path, as shown in figure 2.
    2. - - -

      Figure 2. Remove from Build Path menu item

      - -
    3. Next, when asked about unlinking the folder from the project, select -Yes, as shown in figure 3.
    4. - - - -

      Figure 3. Unlink folder confirmation window

      -
    - -

    This should resolve the error and migrate your library project to the new -ADT environment.

    - -

    Test Projects

    @@ -556,7 +407,7 @@ ADT environment.

    "{@docRoot}guide/developing/testing/index.html">Testing section. -

    Testing a library project

    +

    Testing a Library Project

    There are two recommended ways of setting up testing on code and resources in a library project: