From 377604af7f505baf0cb81fe2340b3b4268924988 Mon Sep 17 00:00:00 2001 From: "smain@google.com" Date: Fri, 5 Dec 2014 18:16:30 -0800 Subject: [PATCH] docs: project updates [CP] Change-Id: If85a51cf2f46a8619798804e880e02f99d1e4ee3 (cherry picked from commit 2a336f4a702a261191d955ee40130849dac32d64) --- .../tools/studio-androidtest-folder.png | Bin 0 -> 10115 bytes docs/html/tools/projects/index.jd | 631 ++++++++++-------- docs/html/tools/projects/projects-cmdline.jd | 4 +- docs/html/tools/projects/projects-studio.jd | 398 +++++++++++ docs/html/tools/projects/templates.jd | 49 +- docs/html/tools/tools_toc.cs | 2 +- 6 files changed, 782 insertions(+), 302 deletions(-) create mode 100644 docs/html/images/tools/studio-androidtest-folder.png create mode 100644 docs/html/tools/projects/projects-studio.jd diff --git a/docs/html/images/tools/studio-androidtest-folder.png b/docs/html/images/tools/studio-androidtest-folder.png new file mode 100644 index 0000000000000000000000000000000000000000..6881741157fe3d6ee29fdbc84efeb30de7284115 GIT binary patch literal 10115 zcmZX41yoy2xAvjMiWiEzm*Q?giWG<9F2$WM5h7gNca=U)5MaUXpvs8+d8E*?RfB^RNNzT-{u3I6bXAY;0UT?cKbNpLR+D z03Dzt_gcp{^KjA6L`U}yIN9dm!3pbOh>nV)`%%oK68a+rF*&&~{N7KHlXsv(UZsbb z-&`=rd{|hUy=#JRs6g)ZkOXHJbCc?`IUPAQFqwsg?Z|OFxoyN88CTut`Ta>rz^KIa zLXQakHrM$OJw%JAgkO9OqKshd`>PNusANYlk(E^WU z$pTZ@73z1Ani&;#2M32IAEX;Hhi&6&B+?Bt@TnQX!z&DG-IhDpvH1XSqhl_(L`XSU0$NBwJ=4JTZ$x^|AEJZSO zFI!S31CCj>TRN_E+@1O=e4ycofc-(O>Db*{!}hogf{DZ>SF(%!8I99;G5UP-&fp5S zl>LL9wY?#4uukh`K@|zYJQN!qw@%*h3|P6le$hl@M6mH^4V)2#2`H0POu7@vh)o!u zocMw?G&JTM@2(DY`xw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oh zM}UMr-)EW}gh~G4-(1YTs@!JUsTb8DGzp?xlPEbdBAHlIrlq`rYd=(_Cl+n}8oB{j z!=DLsY?|Ook1LiADs6me1HU*6>}pe6OH0!KemI?2l^S=aB+y!)X9GR!&)ZD#FAqHS2sL zaEWS>KHtOXI8kP;)^%4NMpzoRE5Lnf8#$1awO$7R< zV9;>ZKmpJi{xtY*#ELtmGnj#$UA{=GPCi@rw9370dlxL?S62%|Eig^Tr7;J%QlZ{n zUiD2)7{H2hneDN;u#b!?zCwI(mCH@Thf@1Z6>IGB4N-jHrRjD)H`R}l!tlbm3Sw>w zmM8guYD#4RpxEgwn`AEW+K6kkD#hAe*mh~4uDLmw6#!8s;#U!rjT(^ z^(ooNHon#(0a-@1gb<1xb5m1Ofa?}vi++Q$lNm#X#omq!=hh5pZ=(9E8NvS{iOien zXJvvm?oP_}dSaP{ZB7N*?3F?p!j){gt;c5@Q2bJg-ybK$;lvt@mzRWdPxgPpr?py! zT!-)TS1gK5tH3_)yAON99g$dip8w-3EzmfTt7K6*eVB3vQkunAyi-QrZaTL#j$P?C zu#neyI^8DM_-pOlPaud#=glEZt3CL--g`@bea2H53RcM0qd>-npAEx18}+^Nv@7 @@ -6,211 +6,317 @@ page.title=Managing Projects

In this document

    -
  1. Android Projects
  2. +
  3. Android Project Files
  4. +
  5. Android Application Modules
  6. -
  7. Library Projects +
  8. Library Modules
    1. Development considerations
  9. -
  10. Test Projects
  11. +
  12. Test Modules
  13. -
  14. Testing a Library Project
  15. +
  16. Testing a Library Module
-

Projects act as containers for storing things such as code and resource files. The SDK tools - expect your projects to follow a specific structure so it can compile and package your - application correctly, so it is highly recommended that you create them with Eclipse and ADT or - with the android tool on the command line. There are three types of projects, and - they all share the same general structure but differ in function:

+

An Android project contains everything that defines your Android app, from app + source code to build configurations and test code. The SDK tools require that your projects + follow a specific structure so it can compile and package your application correctly. + If you're using Android Studio, it takes care of all this for you.

+ +

A module is the first level of containment within a project that encapsulates + specific types of source code files and resources. There are several types of modules + with a project:

-
Android Projects
-
An Android project is the container for your application's source code, resource files, and - files such as the Ant build and Android Manifest file. An application project is the main type - of project and the contents are eventually built into an .apk file that you install on a - device.
+
Android Application Modules
-
Test Projects
+
An Android Application Module is the container for your application's source code, resource + files, and application level settings, such as the module-level build file, resource files, and + Android Manifest file. The application module contents are eventually + built into the .apk file that gets installed on a device.
-
These projects contain code to test your application projects and are built into - applications that run on a device.
+
Test Modules
-
Library Projects
+
These modules contain code to test your application projects and are built into + test applications that run on a device. By default, Android Studio creates the + androidTest module for inserting JUnit tests.
-
These projects contain shareable Android source code and resources that you can reference +
Library Modules
+ +
These modules 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. - Library projects cannot be installed onto a device, however, they are + Library modules cannot be installed onto a device, however, they are pulled into the .apk file at build time.
+ + +
App Engine Modules
+ +
Android Studio lets you easily add a cloud backend to your application. A backend allows you + to implement functionality such as backing up user data to the cloud, serving content to client + apps, real-time interactions, sending push notifications through Google Cloud Messaging for + Android (GCM), and more. App Engine modules are App Engine java Servlet Module for backend + development, App Engine java Endpoints Module to convert server-side Java code annotations into + RESTful backend APIs, and App Engine Backend with Google Cloud Messaging to send push notifications + from your server to your Android devices.
+
-

When you use the Android development tools to create a new project, the essential files and - folders will be created for you. There are only a handful of files and folders generated for you, - and some of them depend on whether you use the Eclipse plugin or the {@code android} tool to - generate your project. As your application grows in complexity, you might require new kinds of +

When you use the Android development tools to create a new project and the module, the essential files + and folders will be created for you. There are only a handful of files and folders generated for you, + and some of them depend on whether you use Android Studio or the {@code android} tool to + generate your module. As your application grows in complexity, you might require new kinds of resources, directories, and files.

-

Android Projects

+

Note: Project folders and files apply across the entire Android +project and override similar module file settings.

-

Android projects are the projects that eventually get built into an .apk file that you install - onto a device. They contain things such as application source code and resource files. - Some are generated for you by default, while others should be created if - required. The following directories and files comprise an Android project:

+ + + +

Android Project Files

+ +

Android Studio project files and settings provide project-wide settings that apply across all + modules in the project.

+ +
+
.idea
+ +
Directory for IntelliJ IDEA settings.
+ + +
app
+ +
Application module directories and files.
+ + +
build
+ +
This directory stories the build output for all project modules.
+ + +
gradle
+ +
Contains the gradler-wrapper files.
+ + +
.gitignore
+ +
Specifies the untracked files that Git should ignore.
+ + +
build.gradle
+ +
Customizable properties for the build system. You can edit this file to specify the default + build settings used by the application modules and also set 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.
+ +
gradle.properties
+ +
Project-wide Gradle settings.
+ + +
gradlew
+ +
Gradle startup script for Unix.
+ + +
gradlew.bat
+ +
Gradle startup script for Windows.
+ +
local.properties
+ +
Customizable computer-specific properties for the build system, such as the path to the SDK + installation. Because the content of the file is specific to the local installation of the SDK, + the local.properties should not be maintained in a source revision control system.
+ + +
.iml
+ +
Module file created by the IntelliJ IDEA to store module information.
+ +
settings.gradle
+ +
Specifies the sub-projects to build.
+ +
+ + +

Android Application Modules

+ +

Android Application Modules are the modules that eventually get built into the .apk + files based on your build settings. They contain things such as application source code and resource + files. Most code and resource files are generated for you by default, while others should be created if + required. The following directories and files comprise an Android application module:

-
src/
-
Contains your stub Activity file, which is stored at - src/your/package/namespace/ActivityName.java. All other source code - files (such as .java or .aidl files) go here as well.
+
build/
-
bin/
+
Contains build folders for the specified build variants. Stored in the main application module.
-
Output directory of the build. This is where you can find the final .apk file and other - compiled resources.
- -
jni/
- -
Contains native code sources developed using the Android NDK. For more information, see the - Android NDK documentation.
- -
gen/
- -
Contains the Java files generated by ADT, such as your R.java file and - interfaces created from AIDL files.
- -
assets/
- -
This is empty. You can use it to store raw asset files. Files that you save here are - compiled into an .apk file as-is, and the original filename is preserved. You can navigate this - directory in the same way as a typical file system using URIs and read files as a stream of - bytes using the {@link android.content.res.AssetManager}. For example, this is a good - location for textures and game data.
- -
res/
- -
- Contains application resources, such as drawable files, layout files, and string values. See - Application Resources for more - information. - -
-
anim/
- -
For XML files that are compiled into animation objects. See the Animation resource - type.
- -
color/
- -
For XML files that describe colors. See the Color Values resource - type.
- -
drawable/
- -
For bitmap files (PNG, JPEG, or GIF), 9-Patch image files, and XML files that describe - Drawable shapes or Drawable objects that contain multiple states (normal, pressed, or - focused). See the Drawable resource type.
- -
layout/
- -
XML files that are compiled into screen layouts (or part of a screen). See the Layout resource type.
- -
menu/
- -
For XML files that define application menus. - See the Menus - resource type.
- -
raw/
- -
For arbitrary raw asset files. Saving asset files here instead of in the - assets/ directory only differs in the way that you access them. These files - are processed by aapt and must be referenced from the application using a resource - identifier in the {@code R} class. For example, this is a good place for media, such as MP3 - or Ogg files.
- -
values/
- -
For XML files that are compiled into many kinds of resource. Unlike other resources in - the res/ directory, resources written to XML files in this folder are not - referenced by the file name. Instead, the XML element type controls how the resources is - defined within them are placed into the {@code R} class.
- -
xml/
- -
For miscellaneous XML files that configure application components. For example, an XML - file that defines a {@link android.preference.PreferenceScreen}, {@link - android.appwidget.AppWidgetProviderInfo}, or Searchability - Metadata. See Application Resources - for more information about configuring these application components.
-
-
libs/
-
Contains private libraries.
+
Contains private libraries. Stored in the main application module.
-
AndroidManifest.xml
-
The control file that describes the nature of the application and each of its components. - For instance, it describes: certain qualities about the activities, services, intent receivers, - and content providers; what permissions are requested; what external libraries are needed; what - device features are required, what API Levels are supported or required; and others. See the - AndroidManifest.xml - documentation for more information
-
project.properties
-
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 - Properties.
+
src/
-
local.properties
+
Contains your stub Activity file, which is stored at + src/main/java//ActivityName>.java. All other source + code files (such as .java or .aidl files) go here as well.
-
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, the local.properties should not -be maintained in a source revision control system. If you use Eclipse, this file is not -used.
+
+
androidTest/
-
ant.properties
+
Contains the instrumentation tests. For more information, see the + Android Test documentation.
-
Customizable properties for the build system. You can edit this file to override default - 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.
+
main/java/com.>project<.>app<
-
build.xml
+
Contains Java code source for the app activities.
+ +
main/jni/
+ +
Contains native code using the Java Native Interface (JNI). For more information, see the + Android NDK documentation.
+ +
main/gen/
+ +
Contains the Java files generated by Android Studio, such as your R.java file and + interfaces created from AIDL files.
+ +
main/assets/
+ +
This is empty. You can use it to store raw asset files. Files that you save here are + compiled into an .apk file as-is, and the original filename is preserved. You can + navigate this directory in the same way as a typical file system using URIs and read files as a + stream of bytes using the {@link android.content.res.AssetManager}. For example, this is a good + location for textures and game data.
+ +
main/res/
+ +
Contains application resources, such as drawable files, layout files, and string values + in the following directories. See + Application Resources for more + information. + +
+
anim/
+ +
For XML files that are compiled into animation objects. See the Animation resource + type.
+ +
color/
+ +
For XML files that describe colors. See the Color Values resource + type.
+ +
drawable/
+ +
For bitmap files (PNG, JPEG, or GIF), 9-Patch image files, and XML files that describe + Drawable shapes or Drawable objects that contain multiple states (normal, pressed, or + focused). See the Drawable resource type.
+ +
layout/
+ +
XML files that are compiled into screen layouts (or part of a screen). See the Layout resource type.
+ +
menu/
+ +
For XML files that define application menus. + See the Menus + resource type.
+ +
raw/
+ +
For arbitrary raw asset files. Saving asset files here is essentially the same as + saving them in the assets/ directory. The only difference is how you + access them. These files + are processed by aapt and must be referenced from the application using a resource + identifier in the {@code R} class. For example, this is a good place for media, such as MP3 + or Ogg files.
+ +
values/
+ +
For XML files that define resources by XML element type. Unlike other resources in + the res/ directory, resources written to XML files in this folder are not + referenced by the file name. Instead, the XML element type controls how the resources + defined within the XML files are placed into the {@code R} class.
+ +
xml/
+ +
For miscellaneous XML files that configure application components. For example, an XML + file that defines a {@link android.preference.PreferenceScreen}, {@link + android.appwidget.AppWidgetProviderInfo}, or + + Searchability Metadata. See + Application Resources + for more information about configuring these application components.
+ +
+ +
AndroidManifest.xml
+ +
The control file that describes the nature of the application and each of its components. + For instance, it describes: certain qualities about the activities, services, intent receivers, + and content providers; what permissions are requested; what external libraries are needed; what + device features are required, what API Levels are supported or required; and others. See the + AndroidManifest.xml + documentation for more information
+ +
+ +
.gitignore/
+ +
Specifies the untracked files ignored by git.
+ +
app.iml/
+ +
IntelliJ IDEA module
+ +
build.gradle
+ +
Customizable properties for the build system. You can edit this file to override default + build settings used by the manifest file and also set 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.
+ +
proguard-rules.pro
+ +
ProGuard settings file.
-
The Ant build file for your project. This is only applicable for projects that - you build with Ant.
-

Library Projects

+ + +

Library Module

-

An Android library project is a development project that holds shared Android - source code and resources. Other Android application projects can reference the library project +

An Android library module is a development module that holds shared Android + source code and resources. Other Android application modules can reference the library module 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.

+ application modules can reference the same library module and any single application module + can reference multiple library modules.

Note: You need SDK Tools r14 or newer to use the new library - project feature that generates each library project into its own JAR file. + module feature that generates each library module into its own JAR file. You can download the tools and platforms using the Android SDK Manager, as described in Exploring the SDK.

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 - versions. Here are some common scenarios in which you could make use of library projects:

+ can move them to a library module so that it is easier to maintain across applications and + versions. Here are some common scenarios in which you could make use of library modules:

  • If you are developing multiple related applications that use some of the same components, - you move the redundant components out of their respective application projects and create a - single, reuseable set of the same components in a library project.
  • + you move the redundant components out of their respective application module and create a + single, reusable set of the same components in a library module.
  • If you are creating an application that exists in both free and paid versions. You move - the part of the application that is common to both versions into a library project. The two - dependent projects, with their different package names, will reference the library project + the part of the application that is common to both versions into a library module. The two + dependent modules, with their different package names, will reference the library module and provide only the difference between the two application versions.
-

Structurally, a library project is similar to a standard Android application project. For - example, it includes a manifest file at the project root, as well as src/, - res/ and similar directories. The project can contain the same types of source - code and resources as a standard Android project, stored in the same way. For example, source - code in the library project can access its own resources through its R class.

+

Structurally, a library module is similar to a standard Android application module. For + example, it includes a manifest file at the module root, as well as src/, + res/ and similar directories. The module can contain the same types of source + code and resources as a standard Android module, stored in the same way. For example, source + code in the library module can access its own resources through its R class.

-

However, a library project differs from a standard Android application project in that you +

However, a library module differs from a standard Android application module in that you cannot compile it directly to its own .apk and run it on an Android device. - Similarly, you cannot export the library project to a self-contained JAR file, as you would do + Similarly, you cannot export the library module to a self-contained JAR file, as you would do for a true library. Instead, you must compile the library indirectly, by referencing the library in the dependent application and building that application.

-

When you build an application that depends on a library project, the SDK tools compile the - library into a temporary JAR file and uses it in the main project, then uses the +

When you build an application that depends on a library module, the SDK tools compile the + library into a temporary JAR file and use it in the main module, then uses the result to generate the .apk. 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 + priority and that the resource in the library module is not compiled into the application .apk. This gives your application the flexibility to either use or redefine any resource behaviors or values that are defined in any library.

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 + modules, then specify the relative priority of the resources in each library. This lets you build up the resources actually used in your application in a cumulative manner. When two 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.

-

Once you have added references to library projects to your Android project, +

Once you have added references to library modules to your Android application module, 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.

-

Library projects can reference other library projects and can import an external library - (JAR) in the normal way.

+

Library modules can reference other library modules and can import an external library + (JAR) in the normal way.

Development considerations

-

As you develop your library project and dependent applications, keep the points listed below +

As you develop your library modules 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 - project, a given resource ID might be defined in both projects. In this case, the tools select +

    Since the tools merge the resources of a library module with those of a dependent application + module, a given resource ID might be defined in both modules. In this case, the tools select the resource from the application, or the library with highest priority, and discard the other resource. As you develop your applications, be aware that common resource IDs are likely to be defined in more than one project and will be merged, with the resource from the application or @@ -297,67 +403,65 @@ used.

  • Use prefixes to avoid resource conflicts

    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).

  • + consistent naming scheme that is unique to the module (or is unique across all project modules).

    -
  • You cannot export a library project to a JAR file

    +
  • You cannot export a library module to a JAR file

    -

    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.

  • +

    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.

    -
  • A library project can include a JAR library

    +
  • A library module can include a JAR library

    -

    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.

  • +

    You can develop a library module that itself includes a JAR library; however you need to + manually edit the dependent application modules's build path and add a path to the JAR file.

    -
  • A library project can depend on an external JAR library

    +
  • A library module can depend on an external JAR library

    -

    You can develop a library project that depends on an external library (for example, the Maps +

    You can develop a library module that depends on an external library (for example, the Maps external library). In this case, the dependent application must build against a target that includes the external library (for example, the Google APIs Add-On). Note also that both the - library project and the dependent application must declare the external library in their manifest + library module and the dependent application must declare the external library in their manifest files, in a <uses-library> element.

  • -
  • Library projects cannot include raw assets

    +
  • Library modules cannot include raw assets

    The tools do not support the use of raw asset files (saved in the assets/ directory) - in a library project. Any asset resources + in a library module. Any asset resources used by an application must be stored in the assets/ directory of the application - project itself. However, resource files saved in the - res/ directory are supported.

  • + module itself. However, resource files saved in the res/ directory are supported.

    -
  • Platform version must be lower than or equal to the Android project

    +
  • Platform version must be lower than or equal to the Android module

    -

    A library is compiled as part of the dependent application project, so the API used in the - library project must be compatible with the version of the Android library used to compile the - application project. In general, the library project should use an A library is compiled as part of the dependent application module, so the API used in the + library module must be compatible with the version of the Android library used to compile the + application module. In general, the library module should use an API level that is the same as — or lower - than — that used by the application. If the library project uses an API level that is - higher than that of the application, the application project will not compile. It is + than — that used by the application. If the library module uses an API level that is + higher than that of the application, the application module 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.

  • + used in an Android 1.6 (API level 4) or Android 2.1 (API level 7) module, for instance.

    -
  • No restriction on library package names

    +
  • No restriction on library module names

    There is no requirement for the package name of a library to be the same as that of applications that use it.

  • -
  • Each library project creates its own R class

    +
  • Each library module creates its own R class

    -

    When you build the dependent application project, library projects are compiled and - merged with the application project. Each library has its own R class, named according +

    When you build the dependent application modules, library modules are compiled and + merged with the application module. Each library has its own R class, named according to the library's package name. The R 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.

  • + module and the library module is created in all the packages that are needed including the main + module's package and the libraries' packages.

    -
  • Library project storage location

    +
  • Library module storage location

    -

    There are no specific requirements on where you should store a library project, relative to a - dependent application project, as long as the application project can reference the library - project by a relative link. What is important is that the main - project can reference the library project through a relative link.

  • +

    There are no specific requirements on where you should store a library module, relative to a + dependent application module, as long as the application module can reference the library + module by a relative link. What is important is that the main + module can reference the library module through a relative link.

Test Projects

@@ -365,82 +469,55 @@ be added in a future

Test projects contain Android applications that you write using the Testing and Instrumentation framework. 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 - Android project.

+ access to Android system objects.

+ +

The test projects are now automatically part of the app source folder. When a new application + module is created, Android Studio creates the src/androidTest source set. This + source set contains tests for the default configuration and is combined with the debug + build type to generate a test application.

+ + +

Figure 1. androidTest Folder.

+ +

Note: The src/androidTest source set may not be + created for every type of available module template. If this source set is not created, you + can just create it for that module.

+ +

For each product flavor, create a test folder specific to that product flavor.

-
src/
+
src/main/
+
src/androidTest/ -
Includes your test source files. Test projects do not require an Activity .java - file, but can include one.
+
src/productFlavor1/
+
src/testproductFlavor1/
-
gen/
+
src/productFlavor2/
+
src/testproductFlavor2/
-
This contains the Java files generated by ADT, such as your R.java file and - interfaces created from AIDL files.
- -
assets/
- -
This is empty. You can use it to store raw asset files.
- -
res/
- -
A folder for your application resources, such as drawable files, layout files, string - values, etc. See Application - Resources.
- -
AndroidManifest.xml
- -
The Android Manifest for your project. See The AndroidManifest.xml File. Test - Projects have a special - <instrumentation> - element that connects the test project with the application project.
- -
project.properties
- -
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 Properties.
- -
local.properties
- -
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.
- -
ant.properties
- -
Customizable properties for the build system. You can edit this file to override default - 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.
- -
build.xml
- -
The Ant build file for your project. This is only applicable for projects that - you build with Ant.
-

For more information, see the Testing section.

+

The test manifests are always generated so a manifest in a test source set is optional.

+ +

The test applications run against the debug build type. This can be configured + using the testBuildType property in the build file.

-

Testing a Library Project

+

For more information, see the + Testing section.

+ + +

Testing a Library Module

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

+ module:

  • You can set up a test - project that instruments an application project that depends on the library project. You - can then add tests to the project for library-specific features.
  • + module that instruments an application module that depends on the library module. You + can then add tests to the module for library-specific features. -
  • You can set up a standard application project that depends on the library and put - the instrumentation in that project. This lets you create a self-contained project that +
  • You can set up a standard application module that depends on the library and put + the instrumentation in that module. This lets you create a self-contained module that contains both the tests/instrumentations and the code to test.
diff --git a/docs/html/tools/projects/projects-cmdline.jd b/docs/html/tools/projects/projects-cmdline.jd index 29d0e57acac96..f0830fec80541 100644 --- a/docs/html/tools/projects/projects-cmdline.jd +++ b/docs/html/tools/projects/projects-cmdline.jd @@ -118,7 +118,7 @@ android create project \

Updating a Project

-

If you're upgrading a project from an older version of the Android SDK or want to create a new +

If you're up grading a project from an older version of the Android SDK or want to create a new project from existing code, use the android update project command to update the project to the new development environment. You can also use this command to revise the build target of an existing project (with the --target option) and the project name (with @@ -288,7 +288,7 @@ android.library.reference.1=path/to/library_projectC

Building a dependent application

To build an application project that depends on one or more library projects, you can use the - standard Ant build commands and compile modes, as described in Building and Running. The tools compile and merge all libraries referenced by the application as part of compiling the dependent application project. No additional commands or steps are necessary.

diff --git a/docs/html/tools/projects/projects-studio.jd b/docs/html/tools/projects/projects-studio.jd new file mode 100644 index 0000000000000..508253774574b --- /dev/null +++ b/docs/html/tools/projects/projects-studio.jd @@ -0,0 +1,398 @@ +page.title=Managing Projects from Android Studio + +@jd:body + + + + +

Android Studio provides graphical tools for creating and managing Android projects, which +contain everything that define your Android apps, from app source code to build configurations and +test code. Each project contains one or more different types of modules, such as + application modules, library modules, and test modules.

+ +

This guide explains how to create Android projects and different modules using +Android Studio. +For more information about the Android project structure and module types, read Managing Projects Overview.

+ + + +

Creating an Android Project

+ +

Android Studio makes it easy to create Android apps for several form factors, such as phone, +tablet, TV, Wear, and Google Glass. The New Project wizard lets you choose the form factors +for your app and populates the project structure with everything you need to get started.

+ +

Follow the steps in this section to create a project in Android Studio.

+ +

Step 1: Create a New Project

+ +

If you didn't have a project opened, Android Studio shows the Welcome screen. +To create a new project, click New Project.

+ +

If you had a project opened, Android Studio shows the development environment. +To create a new project, click File > New Project.

+ +

The next window lets you configure the name of your app, the package name, and the location +of your project.

+ + +

Figure 1. Choose a name for your project.

+ +

Enter the values for your project then click Next.

+ +

Step 2: Select Form Factors and API Level

+ +

The next window lets you select the form factors supported by your app, such as phone, tablet, +TV, Wear, and Google Glass. The selected form factors become the application modules witin the +project. For each form factor, you can also select the API Level for that app. To get more information, +click Help me choose.

+ + +

Figure 2. Select the API Level.

+ +

The API Level window shows the distribution of mobile devices running each version of Android, +as shown in figure 3. Click on an API level to see a list of features introduced in the corresponding +version of Android. This helps you choose the minimum API Level that has all the features that +your apps needs, so you can reach as many devices as possible. Then click OK.

+ + +

Figure 3. Choose form factors for your app.

+ +

Then, on the Form Factors Window, click Next.

+ + +

Step 3: Add an Activity

+ +

The next screen lets you select an activity type to add to your app, as shown in figure 4. +This screen displays a different set of activities for each of the form factors you selected earlier.

+ + +

Figure 4. Add an activity to your app.

+ +

Choose an activity type then click Next.

+ +

Note: If you choose "Add No Activity", click Finish + to create the project.

+ + +

Step 4: Configure Your Activity

+ +

The next screen lets you configure the activity to add to your app, as shown in figure 5.

+ + +

Figure 5. Choose a name for your activity.

+ +

Enter the activity name, the layout name, and the activity title. Then click +Finish.

+ + +

Step 5: Develop Your App

+ +

Android Studio creates the default structure for your project and opens the development +environment. If your app supports more than one form factor, Android Studio creates a module folder +with complete source files for each of them as shown in figure 6.

+ + +

Figure 6. The default project structure for a mobile app.

+ +

Now you are ready to develop your app. For more information, see the following links:

+ + + + +

Creating an Android Module

+ +

Android application modules contain the src/main/, AndroidManifest.xml, + build.gradle, build output and other files you need to generate your app's APK files. + Android Studio provides a New Module Wizard that you can use to quickly create a new + Android module (or a module from existing code) based on selected application settings, such as + minimum SDK level and activity template.

+ +

To create a new module, select File > New > + Module. Select the desire module type then click Next to enter the basic module + settings:

+ +
    +
  • Enter an Application Name. This name is used as the title of your + application launcher icon when it is installed on a device.
  • + +
  • Enter a Module Name. This text is used as the name of the folder where + your Java-based activity files are stored.
  • + +
  • Enter a Package Name and Package Location. This class + package namespace creates the initial + package structure for your applications code files and is added as the + {@code package} + attribute in your application's + Android manifest file. + This manifest value serves as the unique identifier for your application app when you + distribute it to users. The package name must follow the same rules as packages in the Java + programming language.
  • + +
  • Select the Minimum required SDK. + This setting indicates the lowest version of the Android platform that your application + supports for the selected form factor. This value sets the + minSdkVersion attribute in the build.gradle file.
  • + +

    Note: You can manually change the minimum and target SDK + for your module at any time: Double-click the module's build.gradle in the Project Explorer, + set the targetSdkVersion and targetSdkVersion in the + defaultConfig section.

    + + +
  • Select a Target SDK. This setting indicates the highest version of + Android with which you have tested with your application and sets the + {@code + targetSdkVersion} attribute in your application's' build.gradle file. + + +
  • Select a Compile With API version. This setting specifies what version + of the SDK to compile your project against. We strongly recommend using the most recent + version of the API.
  • + +
  • Select a Language Level API version. This setting specifies what version + of the SDK to compile your project against. We strongly recommend using the most recent + version of the API.
  • + +
  • Select a Theme. This setting specifies which standard Android + visual style is applied to your + application. Select activity template. For more information about Android code templates, see + Using Code TemplatesLeave the + Create activity option checked so you can start your + application with some essential components.
  • + +
  • Click the check box for the required Support Libraries then click Next.
  • + +
  • In the Configure Launcher Icon page, create an icon and options, then click + Next.
  • + +
  • In the Create Activity page, select activity template then click + Next. For more information about Android code templates, see + Using Code Templates. +
  • + +
  • Review the new module settings then click Finish.
  • + +
+ +

The wizard creates a new Android application module according to the options you have chosen.

+ + + +

Setting up a Library Module

+ +

A library module is a standard Android module, so you can create a new one in the same way + as you would a new application module, using the New Module wizard and selecting Android + Library as the module type. The created library module will appear in your project view + along with the other modules.

+ +

You can easily change an existing application module to a library module by changing the + plugin assignment in the build.gradle file to com.android.libary.

+ +
+apply plugin: 'com.android.application'
+
+android {...}
+
+ +
+apply plugin: 'com.android.library'
+
+android {...}
+
+ + +

Adding a dependency on a library module

+ +

The library dependency can be declared in the module's manifest file or in the + file.

+ +

A library modules's manifest file must declare all of the shared components that it includes, + just as would a standard Android application. For more information, see the documentation for + AndroidManifest.xml.

+ +

For example, the TicTacToeLib example library + project declares the activity GameActivity:

+
+<manifest>
+  ...
+  <application>
+    ...
+    <activity android:name="GameActivity" />
+    ...
+  </application>
+</manifest>
+
+ + +

To add the dependency declaration to the build file, edit the build file for the app +module (app/build.gradle) and add a dependency on the lib module:

+ +
+...
+dependencies {
+    ...
+    compile project(":lib")
+}
+
+ +

In this example, the lib module can still be built and tested independently, and +the build system creates an AAR package for it that you could reuse in other projects.

+ +

Note: The library settings in the app/build.gradle +file will override any shared library resources declared in the manifest file.

+ + +

Referencing a library module

+ +

If you are developing an application and want to include the shared code or resources from a + library module, you can also do so easily by adding a reference to the library module in the + module's dependency page.

+ +

To add a reference to a library module, follow these steps:

+ +
    +
  1. Make sure that both the module library and the application module that depends on it are + in your proejct. If one of the modules is missing, import it into your project.
  2. + +
  3. In the project view, right-click the dependent module and select + Open > Module Settings.
  4. + +
  5. Right-click the plus icon to add a new dependencies. +

    If you are adding references to multiple libraries, you can set their relative + priority (and merge order) by selecting a library and using the Up and + Down controls. The tools merge the referenced libraries with your application + starting from lowest priority (bottom of the list) to highest (top of the list). If more than one + library defines the same resource ID, the tools select the resource from the library with higher + priority. The application itself has highest priority and its resources are always used in + preference to identical resource IDs defined in libraries.

    +
  6. + +
  7. Use the Scope drop-down to select how the dependency will be applied.
  8. + +
  9. Click Apply to create the dependency and OK to close the + Project Structure window.
  10. +
+ +

Android Studio rebuilds the module, including the contents of the library module the next time + the project or module is built.

+ + + +

Declaring library components in the manifest file

+ +

In the manifest file of the application module, you must add declarations of all components + that the application will use that are imported from a library module. For example, you must + declare any <activity>, <service>, + <receiver>, <provider>, and so on, as well as + <permission>, <uses-library>, and similar elements.

+ +

Declarations should reference the library components by their fully-qualified package names, + where appropriate.

+ +

For example, the TicTacToeMain example + application declares the library activity GameActivity like this:

+
+<manifest>
+  ...
+  <application>
+    ...
+    <activity android:name="com.example.android.tictactoe.library.GameActivity" />
+    ...
+  </application>
+</manifest>
+
+ +

For more information about the manifest file, see the documentation for AndroidManifest.xml.

+ + +

Using the Android Project View

+ + +

The Android project view in Android Studio shows a flattened version of your project's structure +that provides quick access to the key source files of Android projects and helps you work with +the new Gradle-based build system. The +Android project view:

+ +
    +
  • Groups the build files for all modules at the top level of the project hierarchy.
  • +
  • Shows the most important source directories at the top level of the module hierarchy.
  • +
  • Groups all the manifest files for each module.
  • +
  • Shows resource files from all Gradle source sets.
  • +
  • Groups resource files for different locales, orientations, and screen types in a single group +per resource type.
  • +
+ +
+ +

Figure 9: Show the Android project view.

+
+ + +

Enable and use the Android Project View

+ +

The Android project view is not yet enabled by default. To show the Android project view, +click Project and select Android, as shown in figure 9.

+ +

The Android project view shows all the build files at the top level of the project hierarchy +under Gradle Scripts. Each project module appears as a folder at the top +level of the project hierarchy and contains these three elements at the top level:

+ +
    +
  • java/ - Source files for the module.
  • +
  • manifests/ - Manifest files for the module.
  • +
  • res/ - Resource files for the module.
  • +
+ +

Figure 10 shows how the Android project view groups all the instances of the +ic_launcher.png resource for different screen densities under the same element.

+ +

Note: The Android project view shows a hierarchy that helps you +work with Android projects by providing a flattened structure that highlights the most commonly +used files while developing Android applications. However, the project structure on disk differs +from this representation.

+ + +

Figure 10: The traditional project view (left) and the +Android project view (right).

+ + + + diff --git a/docs/html/tools/projects/templates.jd b/docs/html/tools/projects/templates.jd index fce24fd30c892..966d25fc0b158 100644 --- a/docs/html/tools/projects/templates.jd +++ b/docs/html/tools/projects/templates.jd @@ -28,7 +28,7 @@ page.title=Using Code Templates

The SDK tools provide templates for quickly creating Android application projects with the basic - structure or for adding components to your existing projects. The code templates + structure or for adding components to your existing application modules. The code templates provided by the Android SDK follow the Android design and development guidelines to get you on the right track to creating a beautiful, functional application.

@@ -45,30 +45,29 @@ page.title=Using Code Templates

Application Templates

-

Application templates create basic Android applications that you can immediately run and test - on your Android device. These templates are available when you create a new Android project, +

Application templates create basic Android application modules that you can immediately run and test + on your Android device. These templates are available when you create a new Android module, though you can also use these templates to add new activities - to an existing project.

+ to an existing module.

To use Android application templates:

    -
  1. In Eclipse, with the Android Development Tools (ADT) plugin installed, select File - > New > Android.
  2. -
  3. Select Android > Android Application Project, and click - Next.
  4. +
  5. In Android Studio, select File > New > Module.
  6. Enter the settings for your application, including Application Name, - Project Name, Package Name, API level settings and - presentation Theme, and click Next.
  7. -
  8. Enter the project configuration options, and click Next.
  9. -
  10. Optionally enter launcher icon settings, and click Next.
  11. -
  12. In the Create Activity page, select an application template to use. + Company Domain, Package name, and minimum SDK, + then click Next.
  13. +
  14. Select an application template to use, then click Next. For example,
  15. +
  16. Enter the settings for your activity, including Activity Name, + layout Name, Title, and Menu Resource Name, + then click Finish.

@@ -247,7 +246,7 @@ page.title=Using Code Templates

  • Right click the project folder of the Android application where you want to add an activity.
  • Select New > Other...
  • -
  • Select Android > Android Activity, and click Next.
  • +
  • Select Android > Android Activity, then click Next.
  • Select an activity template, then follow the instructions to add it to your existing application.
      @@ -331,17 +330,23 @@ including the previously mentioned activities as well as the following additiona

      To use Android object templates:

        -
      1. Right click the project folder of the Android application where you want to add a code +
      2. Right-click the module folder of the Android application where you want to add a code component.
      3. -
      4. Select New > Other...
      5. -
      6. Select Android > Android Object, and click Next.
      7. -
      8. Select an object template, then follow the instructions to add it to your existing +
      9. Select New
      10. +
      11. Select the object type and template, then follow the instructions to add it to your existing application.
          -
        • {@link android.content.BroadcastReceiver}
        • -
        • {@link android.content.ContentProvider}
        • -
        • Custom View
        • -
        • {@link android.app.Service}
        • +
        • AIDL
        • +
        • Activity
        • +
        • Folder
        • +
        • Fragment
        • +
        • Google
        • +
        • Other
        • +
        • Service
        • +
        • UI Component
        • +
        • Wear
        • +
        • Widget
        • +
        • XML
      diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index 7f93eeda12dfb..a70bb4c936111 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -56,7 +56,7 @@