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
.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.
-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.
- -| Component | - -Minimum Version | -
|---|---|
| SDK Tools | - -r6 (or higher) | -
| Android 2.2 platform | - -r1 (or higher) | -
| Android 2.1 platform | - -r2 (or higher) | -
| Android 2.0.1 platform | - -not supported | -
| Android 2.0 platform | - -not supported | -
| Android 1.6 platform | - -r3 (or higher) | -
| Android 1.5 platform | - -r4 (or higher) | -
| ADT Plugin | - -0.9.7 (or higher) | -
You can download the tools and platforms using the Android SDK and AVD Manager, as - described in Adding SDK Components.
-As you develop your library project and dependent applications, keep the points listed below in mind:
- +Resource conflicts
Since the tools merge the resources of a library project with those of a dependent application @@ -359,10 +293,7 @@ page.title=Managing Projects
A library cannot be distributed as a binary file (such as a jar file). This is because the library project is compiled by the main project to use the correct resource IDs.
One library project cannot reference another
-A library cannot depend on another library
A library project can include a JAR library
You can develop a library project that itself includes a JAR library, however you need to
@@ -377,11 +308,7 @@ page.title=Managing Projects
files, in a <uses-library>
element.
Library project cannot include AIDL files
-The tools do not support the use of AIDL files in a library project. Any AIDL files used by an - application must be stored in the application project itself.
Library projects cannot include raw assets
The tools do not support the use of raw asset files (saved in the assets/ directory)
@@ -421,82 +348,6 @@ page.title=Managing Projects
project by a relative link. What is important is that the main
project can reference the library project through a relative link.
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:
gen/ source folder), andsrc/ and be
-stored at the root of the project.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.
MyLibrary folder) and choose Build Path >
-Remove from Build Path, as shown in figure 2.
-Figure 2. Remove from Build Path menu item
- -
-
-Figure 3. Unlink folder confirmation window
-This should resolve the error and migrate your library project to the new -ADT environment.
- -There are two recommended ways of setting up testing on code and resources in a library project: