diff options
Diffstat (limited to 'docs/html/guide/developing/projects/index.jd')
-rw-r--r-- | docs/html/guide/developing/projects/index.jd | 122 |
1 files changed, 72 insertions, 50 deletions
diff --git a/docs/html/guide/developing/projects/index.jd b/docs/html/guide/developing/projects/index.jd index 273a405..ac8a1a5 100644 --- a/docs/html/guide/developing/projects/index.jd +++ b/docs/html/guide/developing/projects/index.jd @@ -15,7 +15,7 @@ page.title=Managing Projects </li> <li><a href="#TestProjects">Test Projects</a></li> - + <li><a href="#testing">Testing a Library Project</a></li> </ol> </div> @@ -43,7 +43,7 @@ page.title=Managing Projects <dt><strong>Library Projects</strong></dt> <dd>These projects contain shareable Android source code and resources that you can reference - in Android projects. This is useful when you have common code that you want to reuse. + in Android projects. This is useful when you have common code that you want to reuse. Library projects cannot be installed onto a device, however, they are pulled into the <code>.apk</code> file at build time.</dd> </dl> @@ -125,7 +125,7 @@ page.title=Managing Projects <dt><code>menu/</code></dt> - <dd>For XML files that define application menus. + <dd>For XML files that define application menus. See the <a href="{@docRoot}guide/topics/resources/menu-resource.html">Menus</a> resource type.</dd> @@ -168,23 +168,33 @@ page.title=Managing Projects <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">AndroidManifest.xml</a> documentation for more information</dd> - <dt><code>build.properties</code></dt> + <dt><code>project.properties</code></dt> + + <dd>This file contains project settings, such as the build target. This file is integral to + the project, so maintain it in a source revision control system. To edit project + properties in Eclipse, right-click the project folder and select + <strong>Properties</strong>.</dd> + + <dt><code>local.properties</code></dt> + + <dd>Customizable computer-specific properties for the build system. If you use Ant to build + the project, this contains the path to the SDK installation. Because the content of the file + is specific to the local installation of the SDK, maintained it in a source + revision control system. If you use Eclipse, this file is not used.</dd> + + <dt><code>ant.properties</code></dt> <dd>Customizable properties for the build system. You can edit this file to override default - build settings used by Ant and provide a pointer to your keystore and key alias so that the - build tools can sign your application when built in release mode. If you use Eclipse, this file - is not used.</dd> + build settings used by Ant and also provide the location of your keystore and key alias so that + the build tools can sign your application when building in release mode. This file is integral + to the project, so maintain it in a source revision control system. If you use Eclipse, this + file is not used.</dd> <dt><code>build.xml</code></dt> <dd>The Ant build file for your project. This is only applicable for projects that - you create on the command line.</dd> - - <dt><code>default.properties</code></dt> + you build with Ant.</dd> - <dd>This file contains project settings, such as the build target. This files is integral to - the project, as such, it should be maintained in a Source Revision Control system. Do not edit - the file manually.</dd> </dl> <h2 id="LibraryProjects">Library Projects</h2> @@ -199,7 +209,7 @@ page.title=Managing Projects <p>To download the sample applications and run them as projects in your environment, use the <em>Android SDK and AVD Manager</em> to download the "Samples for - SDK API 8" component into your SDK.</p> + SDK API 8" (or later) component into your SDK.</p> <p>For more information and to browse the code of the samples, see the <a href="{@docRoot}resources/samples/TicTacToeMain/index.html">TicTacToeMain @@ -212,9 +222,10 @@ page.title=Managing Projects and, at build time, include its compiled sources in their <code>.apk</code> files. Multiple application projects can reference the same library project and any single application project can reference multiple library projects.</p> - - <p class="note"><strong>Note:</strong> 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 + + <p class="note"><strong>Note:</strong> You need SDK Tools r14 or newer to use the new library + project feature that generates each library project into its own JAR file. + You can download the tools and platforms using the <em>Android SDK and AVD Manager</em>, as described in <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</p> @@ -246,12 +257,12 @@ page.title=Managing Projects library in the dependent application and building that application.</p> <p>When you build an application that depends on a library project, the SDK tools compile the - library and merge its sources with those in the main project, then use the result to generate - the <code>.apk</code>. In cases where a resource ID is defined in both the application and the - library, the tools ensure that the resource declared in the application gets priority and that - the resource in the library project is not compiled into the application <code>.apk</code>. - This gives your application the flexibility to either use or redefine any resource behaviors or - values that are defined in any library.</p> + library into a temporary JAR file and uses it in the main project, then uses the + result to generate the <code>.apk</code>. In cases where a resource ID is defined in both the + application and the library, the tools ensure that the resource declared in the application gets + priority and that the resource in the library project is not compiled into the application + <code>.apk</code>. This gives your application the flexibility to either use or redefine any + resource behaviors or values that are defined in any library.</p> <p>To organize your code further, your application can add references to multiple library projects, then specify the relative priority of the resources in each library. This lets you @@ -259,15 +270,13 @@ page.title=Managing Projects libraries referenced from an application define the same resource ID, the tools select the resource from the library with higher priority and discard the other.</p> - <p>Once you have added references to library projects to your Android project, + <p>Once you have added references to library projects to your Android project, you can set their relative priority. At build time, the libraries are merged with the application one at a time, starting from the lowest priority to the highest.</p> - <p>Note that a library project cannot itself reference another library project and that, at - build time, library projects are <em>not</em> merged with each other before being merged with - the application. However, note that a library can import an external library (JAR) in the - normal way.</p> + <p>Library projects can reference other library projects and can import an external library + (JAR) in the normal way.</p> <h3 id="considerations">Development considerations</h3> @@ -283,22 +292,23 @@ page.title=Managing Projects defined in more than one project and will be merged, with the resource from the application or highest-priority library taking precedence.</p> </li> - + <li><p><strong>Use prefixes to avoid resource conflicts</strong></p> <p>To avoid resource conflicts for common resource IDs, consider using a prefix or other consistent naming scheme that is unique to the project (or is unique across all projects).</p></li> - + <li><p><strong>You cannot export a library project to a JAR file</strong></p> - <p>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.</p></li> + <p>A library cannot be distributed as a binary file (such as a JAR file). This will +be added in a future + version of the SDK Tools.</p></li> <li><p><strong>A library project can include a JAR library</strong></p> <p>You can develop a library project that itself includes a JAR library, however you need to manually edit the dependent application project's build path and add a path to the JAR file.</p></li> - + <li><p><strong>A library project can depend on an external JAR library</strong></p> <p>You can develop a library project that depends on an external library (for example, the Maps @@ -316,7 +326,7 @@ page.title=Managing Projects used by an application must be stored in the <code>assets/</code> directory of the application project itself. However, resource files saved in the <code>res/</code> directory are supported.</p></li> - + <li><p><strong>Platform version must be lower than or equal to the Android project</strong></p> <p>A library is compiled as part of the dependent application project, so the API used in the @@ -327,12 +337,12 @@ page.title=Managing Projects higher than that of the application, the application project will not compile. It is perfectly acceptable to have a library that uses the Android 1.5 API (API level 3) and that is used in an Android 1.6 (API level 4) or Android 2.1 (API level 7) project, for instance.</p></li> - + <li> <p><strong>No restriction on library package names</strong></p> <p>There is no requirement for the package name of a library to be the same as that of applications that use it.</p></li> - + <li><p><strong>Each library project creates its own R class </strong></p> <p>When you build the dependent application project, library projects are compiled and @@ -340,7 +350,7 @@ page.title=Managing Projects to the library's package name. The <code>R</code> class generated from main project and the library project is created in all the packages that are needed including the main project's package and the libraries' packages.</p></li> - + <li><p><strong>Library project storage location</strong></p> <p>There are no specific requirements on where you should store a library project, relative to a @@ -351,7 +361,7 @@ page.title=Managing Projects <h2 id="TestProjects">Test Projects</h2> - <p>Test projects contain Android applications that you write using the + <p>Test projects contain Android applications that you write using the <a href="{@docRoot}guide/topics/testing/index.html">Testing and Instrumentation framework</a>. The framework is an extension of the JUnit test framework and adds access to Android system objects. The file structure of a test project is the same as an @@ -387,24 +397,36 @@ page.title=Managing Projects <code><instrumentation></code></a> element that connects the test project with the application project.</dd> - <dt><code>build.properties</code></dt> + <dt><code>project.properties</code></dt> + + <dd>This file contains project settings, such as the build target and links to the project being +tested. This file is integral to the project, so maintain it in a source +revision control system. To edit project properties in Eclipse, right-click the project folder +and select <strong>Properties</strong>.</dd> + + <dt><code>local.properties</code></dt> + + <dd>Customizable computer-specific properties for the build system. If you use Ant to build + the project, this contains the path to the SDK installation. Because the content of the file + is specific to the local installation of the SDK, it should not be maintained in a Source + Revision Control system. If you use Eclipse, this file is not used.</dd> + + <dt><code>ant.properties</code></dt> <dd>Customizable properties for the build system. You can edit this file to override default - build settings used by Ant and provide a pointer to your keystore and key alias so that the - build tools can sign your application when built in release mode.</dd> + build settings used by Ant and provide the location to your keystore and key alias, so that the + build tools can sign your application when building in release mode. This file is integral to + the project, so maintain it in a source revision control system. + If you use Eclipse, this file is not used.</dd> <dt><code>build.xml</code></dt> - <dd>The Ant build file for your project.</dd> - - <dt><code>default.properties</code></dt> + <dd>The Ant build file for your project. This is only applicable for projects that + you build with Ant.</dd> + </dl> - <dd>This file contains project settings, such as the build target. This files is integral to - the project, as such, it should be maintained in a Source Revision Control system. It should - never be edited manually — to edit project properties, right-click the project folder and - select "Properties".</dd> - </dl>For more information, see the <a href= - "{@docRoot}guide/developing/testing/index.html">Testing</a> section. + <p>For more information, see the <a href= + "{@docRoot}guide/developing/testing/index.html">Testing</a> section.</p> <h2 id="testing">Testing a Library Project</h2> |