Merge "Merge "Merge "improved structure and organization between video and training docs on the Training landing page." into mnc-mr-docs am: 49b17d3 am: 30c61f9 am: 07bfe29" into nyc-dev am: 2b0a5c9 am: bf7a6fa" into nyc-mr1-dev-plus-aosp
diff --git a/docs/html/develop/index.jd b/docs/html/develop/index.jd
index 460d056..49235ae 100644
--- a/docs/html/develop/index.jd
+++ b/docs/html/develop/index.jd
@@ -9,7 +9,7 @@
excludeFromSuggestions=true
@jd:body
-<section class="dac-expand dac-hero dac-section-light">
+<section class="dac-expand dac-hero dac-section-light" style="background:#FFE57F">
<div class="wrap">
<div class="cols dac-hero-content">
<div class="col-1of2 col-push-1of2 dac-hero-figure">
@@ -19,30 +19,37 @@
frameborder="0" allowfullscreen=""
style="float: right;"></iframe>
-->
- <img class="dac-hero-image" src="{@docRoot}images/develop/hero_image_studio5_2x.png"
- srcset="/images/develop/hero_image_studio5.png 1x, /images/develop/hero_image_studio5_2x.png 2x" />
+ <img class="dac-hero-image" src="{@docRoot}images/tools/studio/studio-feature-instant-run_2x.png" />
</div>
<div class="col-1of2 col-pull-1of2">
- <h1 class="dac-hero-title">Get Started with Android Studio</h1>
+ <h1 class="dac-hero-title">Android Studio 2.0,<br>now available!</h1>
<p class="dac-hero-description">
- Everything you need to build incredible app experiences on phones and tablets, Wear, TV, and Auto. </p>
+ The latest version of Android Studio is the biggest update yet.
+ It includes new features like <strong>Instant Run</strong>, which
+ dramatically speeds up your edit, build, and run cycles, keeping
+ you "in the flow."</p>
</p>
- <a class="dac-hero-cta" href="{@docRoot}sdk/index.html">
- <span class="dac-sprite dac-auto-chevron"></span>
- Set up Android Studio
- </a><br>
- <a class="dac-hero-cta" href="{@docRoot}training/index.html">
- <span class="dac-sprite dac-auto-chevron"></span>
- Build your first app
- </a><br>
- <a class="dac-hero-cta" href="{@docRoot}guide/index.html">
- <span class="dac-sprite dac-auto-chevron"></span>
- Learn about Android
- </a><br>
- <a class="dac-hero-cta" href="{@docRoot}samples/index.html">
- <span class="dac-sprite dac-auto-chevron"></span>
- Sample projects
- </a><br>
+ <div class="cols">
+ <div class="col-1of2">
+ <a class="dac-hero-cta" href="{@docRoot}sdk/index.html">
+ <span class="dac-sprite dac-auto-chevron"></span>
+ Get Android Studio
+ </a><br>
+ <a class="dac-hero-cta" href="{@docRoot}training/index.html">
+ <span class="dac-sprite dac-auto-chevron"></span>
+ Build your first app
+ </a>
+ </div>
+ <div class="col-1of2">
+ <a class="dac-hero-cta" href="{@docRoot}guide/index.html">
+ <span class="dac-sprite dac-auto-chevron"></span>
+ Learn about Android
+ </a><br>
+ <a class="dac-hero-cta" href="{@docRoot}samples/index.html">
+ <span class="dac-sprite dac-auto-chevron"></span>
+ See sample projects
+ </a>
+ </div>
</div>
</div>
<!--<div class="dac-section dac-small">
diff --git a/docs/html/images/tools/ai-appindexingtest.png b/docs/html/images/tools/ai-appindexingtest.png
new file mode 100644
index 0000000..385bc21
--- /dev/null
+++ b/docs/html/images/tools/ai-appindexingtest.png
Binary files differ
diff --git a/docs/html/images/tools/as-cleanrerun.png b/docs/html/images/tools/as-cleanrerun.png
new file mode 100644
index 0000000..7d57b0f
--- /dev/null
+++ b/docs/html/images/tools/as-cleanrerun.png
Binary files differ
diff --git a/docs/html/images/tools/as-launchavdm.png b/docs/html/images/tools/as-launchavdm.png
index bf15981..f2c7bf3 100644
--- a/docs/html/images/tools/as-launchavdm.png
+++ b/docs/html/images/tools/as-launchavdm.png
Binary files differ
diff --git a/docs/html/images/tools/as-ok.png b/docs/html/images/tools/as-ok.png
new file mode 100644
index 0000000..244a77f
--- /dev/null
+++ b/docs/html/images/tools/as-ok.png
Binary files differ
diff --git a/docs/html/images/tools/as-restart.png b/docs/html/images/tools/as-restart.png
index 12d2923..39122c9 100644
--- a/docs/html/images/tools/as-restart.png
+++ b/docs/html/images/tools/as-restart.png
Binary files differ
diff --git a/docs/html/images/tools/as-stop.png b/docs/html/images/tools/as-stop.png
new file mode 100644
index 0000000..ed1424b
--- /dev/null
+++ b/docs/html/images/tools/as-stop.png
Binary files differ
diff --git a/docs/html/images/tools/as-wrench.png b/docs/html/images/tools/as-wrench.png
new file mode 100644
index 0000000..5886487
--- /dev/null
+++ b/docs/html/images/tools/as-wrench.png
Binary files differ
diff --git a/docs/html/images/tools/instant-run/as-irdebug.png b/docs/html/images/tools/instant-run/as-irdebug.png
new file mode 100644
index 0000000..0754afa
--- /dev/null
+++ b/docs/html/images/tools/instant-run/as-irdebug.png
Binary files differ
diff --git a/docs/html/images/tools/instant-run/as-irrun.png b/docs/html/images/tools/instant-run/as-irrun.png
new file mode 100644
index 0000000..8b5fafa
--- /dev/null
+++ b/docs/html/images/tools/instant-run/as-irrun.png
Binary files differ
diff --git a/docs/html/images/tools/instant-run/update-project-dialog.png b/docs/html/images/tools/instant-run/update-project-dialog.png
new file mode 100644
index 0000000..e106c57
--- /dev/null
+++ b/docs/html/images/tools/instant-run/update-project-dialog.png
Binary files differ
diff --git a/docs/html/images/training/ctl-exec-log.png b/docs/html/images/training/ctl-exec-log.png
new file mode 100644
index 0000000..96bbb81
--- /dev/null
+++ b/docs/html/images/training/ctl-exec-log.png
Binary files differ
diff --git a/docs/html/images/training/ctl-test-results.png b/docs/html/images/training/ctl-test-results.png
new file mode 100644
index 0000000..bb2fc93
--- /dev/null
+++ b/docs/html/images/training/ctl-test-results.png
Binary files differ
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index 0250c1e..923a6d7 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -503,7 +503,7 @@
<li>2 GB of available disk space minimum (500 MB for IDE + 1.5 GB for
Android SDK and emulator system image). 4 GB Recommended.</li>
<li>1280 x 800 minimum screen resolution</li>
-<li>Java Development Kit (JDK) 8</li>
+<li>Java Development Kit (JDK) 6</li>
</ul>
</div>
diff --git a/docs/html/tools/building/building-studio.jd b/docs/html/tools/building/building-studio.jd
index 2e3615e..43e3129 100644
--- a/docs/html/tools/building/building-studio.jd
+++ b/docs/html/tools/building/building-studio.jd
@@ -7,10 +7,34 @@
<div id="qv">
<h2>In this document</h2>
<ol>
- <li><a href="#run-configuration">Changing the run configuration</a> </li>
- <li><a href="#changing-variant">Changing build variants</a></li>
- <li><a href="#gradle-console">Monitoring the build process</a></li>
- <li><a href="#generating-apks">Generating APKs</a></li>
+ <li>
+ <a href="#run-configuration">Changing the run configuration</a>
+ </li>
+
+ <li>
+ <a href="#changing-variant">Changing build variants</a>
+ </li>
+
+ <li>
+ <a href="#gradle-console">Monitoring the build process</a>
+ </li>
+
+ <li>
+ <a href="#generating-apks">Generating APKs</a>
+ </li>
+
+ <li>
+ <a href="#instant-run">About Instant Run</a>
+ <ol>
+ <li>
+ <a href="#set-up-ir">Configuring and optimizing your project for Instant Run</a>
+ </li>
+
+ <li>
+ <a href="#ir-limitations">Limitations of Instant Run</a>
+ </li>
+ </ol>
+ </li>
</ol>
<h2>See also</h2>
@@ -31,7 +55,9 @@
<p>
By default, Android Studio sets up new projects to deploy to the Emulator or
- a physical device with just a few clicks.
+ a physical device with just a few clicks. With Instant Run, you can push
+ changes to methods and existing app resources to a running app without
+ building a new APK, so code changes are visible almost instantly.
</p>
<p>
@@ -138,8 +164,8 @@
</h3>
<p>
- You can view details about the build process by clicking <em>Gradle
- Console</em> <img src="{@docRoot}images/tools/as-gradlebutton.png" alt=""
+ You can view details about the build process by clicking <strong>Gradle
+ Console</strong> <img src="{@docRoot}images/tools/as-gradlebutton.png" alt=""
style="vertical-align:bottom;margin:0;">. The console displays each
task that Gradle executes in order to build your app, as shown in figure 1.
</p>
@@ -160,7 +186,40 @@
<p>
If an error occurs during the build process, the <em>Messages</em> window
- will appear to describe the issue.
+ appears to describe the issue. Gradle may recommend some command-line
+ options to help you resolve the issue, such as <code>--stacktrace</code> or
+ <code>--debug</code>. To use command-line options with your build process:
+</p>
+
+<ol>
+ <li>Open the <strong>Settings</strong> or <strong>Preferences</strong>
+ dialog:
+ <ul>
+ <li>On Windows or Linux, select <strong>File</strong> >
+ <strong>Settings</strong> from the main menu.
+ </li>
+
+ <li>On Mac OSX, select <strong>Android Studio</strong> >
+ <strong>Preferences</strong> from the main menu.
+ </li>
+ </ul>
+ </li>
+
+ <li>Navigate to <strong>Build, Execution, Deployment</strong> >
+ <strong>Compiler</strong>.
+ </li>
+
+ <li>In the text field next to <em>Command-line Options</em>, enter your
+ command-line options.
+ </li>
+
+ <li>Click <strong>OK</strong> to save and exit.
+ </li>
+</ol>
+
+<p>
+ Gradle will apply these command-line options the next time you try building
+ your app.
</p>
<h3 id="generating-apks">
@@ -184,4 +243,502 @@
<p class="img-caption">
<strong>Figure 2.</strong> Click the link to locate the generated APK
files.
-</p>
\ No newline at end of file
+</p>
+
+<h2 id="instant-run">About Instant Run</h3>
+
+<p>
+ Introduced in Android Studio 2.0, Instant Run is a behavior for the
+ <strong>Run</strong> <img src="{@docRoot}images/tools/as-run.png" alt=""
+ style="vertical-align:bottom;margin:0;"> and <strong>Debug</strong> <img src=
+ "{@docRoot}images/tools/as-debugbutton.png" alt="" style=
+ "vertical-align:bottom;margin:0;"> commands that significantly reduces the
+ time between updates to your app. Instant Run pushes updates to your app
+ without building a new APK, so changes are visible much more quickly.
+</p>
+
+<p>
+ Instant Run is supported only when you deploy the debug build variant, use
+ Android Plugin for Gradle version 2.0.0 or higher, and set
+ <code>minSdkVersion</code> to 15 or higher in your app's module-level
+ <code>build.gradle</code> file. For the best performance, set
+ <code>minSdkVersion</code> to 21 or higher.
+</p>
+
+<p>
+ After deploying an app, a small, yellow thunderbolt icon appears within the
+ <strong>Run</strong> <img src=
+ "{@docRoot}images/tools/instant-run/as-irrun.png" alt="" style=
+ "vertical-align:bottom;margin:0;"> button (or <strong>Debug</strong>
+ <img src="{@docRoot}images/tools/instant-run/as-irdebug.png" alt="" style=
+ "vertical-align:bottom;margin:0;"> button), indicating that Instant Run is
+ ready to push updates the next time you click the button. Instead of building
+ a new APK, it pushes just those new changes and, in some cases, the app
+ doesn't even need to restart but immediately shows the effect of those code
+ changes.
+</p>
+
+<p>
+ Instant Run pushes updated code and resources to your connected device or
+ emulator by performing a <em>hot swap</em>, <em>warm swap</em>, or <em>cold
+ swap</em>. It automatically determines the type of swap to perform based on
+ the type of change you made. The following table describes how Instant Run
+ behaves when you push certain code changes to a target device.
+</p>
+
+<table id="ir-table">
+ <col width="40%">
+ <tr>
+ <th scope="col">
+ Code Change
+ </th>
+ <th scope="col">
+ Instant Run Behavior
+ </th>
+ </tr>
+
+ <tr id="hot-swap">
+ <td>
+ <ul>
+ <li>Change implementation code of an existing method
+ </li>
+ </ul>
+ </td>
+ <td>
+ <p>
+ Supported with <strong>hot swap</strong>: This is the
+ fastest type of swap and makes changes visible much more quickly. Your
+ application keeps running and a stub method with the new implementation is used
+ the next time the method is called.
+ </p>
+
+ <p>
+ Hot swaps do not re-initialize objects in your running app. You may need to
+ restart the current activity, or <a href="#rerun">restart the app</a>, before
+ you see certain updates. By default, Android Studio automatically restarts the
+ current activity after performing a hot swap. If you do not want this behavior,
+ you can <a href="#activity-restart">disable automatic activity restarts</a>.
+ </p>
+ </td>
+ </tr>
+
+ <tr id="warm-swap">
+ <td>
+ <ul>
+ <li>Change or remove an existing resource
+ </li>
+ </ul>
+ </td>
+ <td>
+ Supported with <strong>warm swap</strong>: This swap
+ is still very fast, but Instant Run must restart the current activity when it
+ pushes the changed resources to your app. Your app keeps running, but a small
+ flicker may appear on the screen as the activity restarts—this is normal.
+ </td>
+ </tr>
+
+ <tr id="cold-swap">
+ <td>
+ Structural code changes, such as:
+ <ul>
+ <li>Add, remove, or change:
+ <ul>
+ <li>an annotation
+ </li>
+
+ <li>an instance field
+ </li>
+
+ <li>a static field
+ </li>
+
+ <li>a static method signature
+ </li>
+
+ <li>an instance method signature
+ </li>
+ </ul>
+ </li>
+
+ <li>Change which parent class the current class inherits from
+ </li>
+
+ <li>Change the list of implemented interfaces
+ </li>
+
+ <li>Change a class's static initializer
+ </li>
+
+ <li>Reorder layout elements that use dynamic resource IDs
+ </li>
+ </ul>
+ </td>
+ <td>
+ <p>
+ Supported with <strong>cold swap</strong> (API level 21 or higher): This swap
+ is a bit slower because, although a new APK is not required, Instant Run must
+ restart the whole app when it pushes structural code changes.
+ </p>
+
+ <p>
+ For target devices running API level 20 or lower, Android Studio
+ deploys a full APK.
+ </p>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <ul>
+ <li>Change the app manifest
+ </li>
+
+ <li>Change resources reference by the app manifest
+ </li>
+
+ <li>Change an Android widget UI element (requires a <a href="#rerun">
+ Clean and Rerun</a>)
+ </li>
+ </ul>
+ </td>
+ <td>
+ <p>
+ When making changes to the app's manifest or resources referenced by the
+ manifest, Android Studio automatically <strong>deploys a new build</strong>
+ in order to apply these changes. This is because certain information about
+ the app, such as its name, app icon resources, and intent filters, are
+ determined from the manifest when the APK is installed on the device.
+ </p>
+
+ <p>
+ If your build process automatically updates any part of the app manifest,
+ such as automatically iterating <code>versionCode</code> or
+ <code>versionName</code>, you will not be able to benefit from the full
+ performance of Instant Run. We recommend that you disable automatic updates
+ to any part in the app manifest in your debug build variants.
+ </p>
+ </td>
+ </tr>
+</table>
+
+<p class="note">
+ <strong>Note:</strong> If you need to restart your app after a crash, do not
+ launch it from your target device. Restarting your app from your target
+ device does not apply any of your code changes since the last cold swap or
+ <em>incremental build</em>. To launch your app with all your recent changes,
+ click <strong>Run</strong> <img src="{@docRoot}images/tools/as-run.png" alt=
+ "" style="vertical-align:bottom;margin:0;"> (or <strong>Debug</strong>
+ <img src="{@docRoot}images/tools/as-debugbutton.png" alt="" style=
+ "vertical-align:bottom;margin:0;">) from Android Studio.
+</p>
+
+<h4 id="rerun">
+ Using Rerun
+</h4>
+
+<p>
+ When pushing code changes that affect certain initializers, such as changes
+ to an app's {@link android.app.Application#onCreate onCreate()} method, you
+ need to restart your app for the changes to take effect. To perform an
+ <em>incremental build</em> and restart the app, click <strong>Rerun</strong>
+ <img src="{@docRoot}images/tools/as-restart.png" alt="" style=
+ "vertical-align:bottom;margin:0;">.
+</p>
+
+<p>
+ If you need to deploy a <em>clean build</em>, select <strong>Run</strong>
+ > <strong>Clean and Rerun 'app'</strong> <img src=
+ "{@docRoot}images/tools/as-cleanrerun.png" alt="" style=
+ "vertical-align:bottom;margin:0;"> from the main menu, or hold down the
+ <strong>Shift</strong> key while clicking <strong>Rerun</strong> <img src=
+ "{@docRoot}images/tools/as-restart.png" alt="" style=
+ "vertical-align:bottom;margin:0;">. This action stops the running app,
+ performs a full clean build, and deploys the new APK to your target device.
+</p>
+
+<h4 id="activity-restart">
+ Disabling automatic activity restart
+</h4>
+
+<p>
+ When performing a hot swap, your app keeps running but Android Studio
+ automatically restarts the current activity. To disable this default setting:
+</p>
+
+<ol>
+ <li>Open the <strong>Settings</strong> or <strong>Preferences</strong>
+ dialog:
+ <ul>
+ <li>On Windows or Linux, select <strong>File</strong> >
+ <strong>Settings</strong> from the main menu.
+ </li>
+
+ <li>On Mac OSX, select <strong>Android Studio</strong> >
+ <strong>Preferences</strong> from the main menu.
+ </li>
+ </ul>
+ </li>
+
+ <li>Navigate to <strong>Build, Execution, Deployment</strong> >
+ <strong>Instant Run</strong>.
+ </li>
+
+ <li>Uncheck the box next to <strong>Restart activity on code
+ changes</strong>.
+ </li>
+</ol>
+
+<p>
+ If automatic activity restart is disabled, you can manually restart the current
+ activity from the menu bar by selecting <strong>Run</strong> > <strong>Restart
+ Activity</strong>.
+</p>
+
+<h3 id="set-up-ir">
+ Configuring and optimizing your project for Instant Run
+</h3>
+
+<p>
+ Android Studio enables Instant Run by default for projects built using
+ Android Plugin for Gradle 2.0.0 and higher.
+</p>
+
+<p>
+ To update an existing project with the latest version of the plugin:
+</p>
+
+<ol>
+ <li>Open the <strong>Settings</strong> or <strong>Preferences</strong>
+ dialog.
+ </li>
+
+ <li>
+ <p>
+ Navigate to <strong>Build, Execution, Deployment</strong> >
+ <strong>Instant Run</strong> and click <strong>Update Project</strong>,
+ as shown in figure 3.
+ </p>
+
+ <p>
+ If the option to update the project does not appear, it’s already
+ up-to-date with the latest Android Plugin for Gradle.
+ </p>
+
+ <img src="{@docRoot}images/tools/instant-run/update-project-dialog.png"
+ alt="" height="51">
+
+ <p class="img-caption">
+ <strong>Figure 3.</strong> Updating the Android Plugin for Gradle for an
+ existing project.
+ </p>
+ </li>
+</ol>
+
+<p>
+ You also need to <a href="#changing-variant">change the build variant</a> to
+ a debug version of your app to start using Instant Run.
+</p>
+
+<h4 id="configure-dexoptions">
+ Improve build times by configuring DEX resources
+</h4>
+
+<p>
+ When you deploy a clean build, Android Studio instruments your app to allow
+ Instant Run to push code and resource updates. Although updating the running
+ app happens much more quickly, the first build may take longer to complete.
+ You can improve the build process by configuring a few DEX options, such as
+ <code>maxProcessCount</code> and <code>javaMaxHeapSize</code>.
+</p>
+
+<dl>
+ <dt>
+ <code>maxProcessCount</code>
+ </dt>
+
+ <dd>
+ Sets the maximum number of DEX processes that can be started
+ concurrently. If the Gradle daemon is already running, you need to
+ stop the process before initializing it with a new maximum process count.
+ You can terminate the Gradle daemon by calling one of the following from
+ the <em>Terminal</em> window:
+ <ul>
+ <li>On Windows, call <code>gradlew --stop</code>
+ </li>
+
+ <li>On Linux/Mac OSX, call <code>./gradlew --stop</code>
+ </li>
+ </ul>
+ </dd>
+
+ <dt>
+ <code>javaMaxHeapSize</code>
+ </dt>
+
+ <dd>
+ Sets the maximum memory allocation pool size for the dex operation. When
+ passing a value, you can append the letter 'k' to indicate kilobytes, 'm'
+ to indicate megabytes, or 'g' to indicate gigabytes.
+ </dd>
+</dl>
+
+<p>
+ The following example sets <code>maxProcessCount</code> to 4 and
+ <code>javaMaxHeapSize</code> to "2g" in the module-level
+ <code>build.gradle</code> file:
+</p>
+
+<pre>
+android {
+ ...
+ dexOptions {
+ maxProcessCount 8
+ javaMaxHeapSize "2g"
+ }
+}
+</pre>
+
+<p>
+ You should experiment with these settings by incrementing their values and
+ observing the effect on your build times. You could experience a negative
+ impact to performance if you allocate too many resources to the DEX'ing process.
+</p>
+
+<h4 id="windows-defender">
+ Excluding your project from Windows Defender
+</h4>
+
+<p>
+ On Windows systems, Windows Defender may cause slowdowns while using Instant
+ Run. If you are using Windows Defender, you should <a class="external-link"
+ href=
+ "http://answers.microsoft.com/en-us/protect/wiki/protect_defender-protect_scanning/how-to-exclude-a-filefolder-from-windows-defender/f32ee18f-a012-4f02-8611-0737570e8eee">
+ exclude your Android Studio project folder from Windows Defender malware
+ scans</a>.
+</p>
+
+<h4 id="crashlytics">
+ Disabling Crashlytics for your debug build variant
+</h4>
+
+<p>
+ Using Crashlytics is known to cause slower build times. To improve build
+ performance while developing your app, you can <a class="external-link" href=
+ "https://docs.fabric.io/android/crashlytics/build-tools.html#disabling-crashlytics-for-debug-builds">
+ disable Crashlytics for your debug build variant</a>.
+</p>
+
+<h3 id="ir-limitations">
+ Limitations of Instant Run
+</h3>
+
+<p>
+ Instant Run is designed to speed up the build and deploy process in most
+ situations. However, there are some aspects to using Instant Run that might
+ affect its behavior and compatibility with your app. If you experience any
+ other issues while using Instant Run, please <a class="external-link" href=
+ "http://tools.android.com/filing-bugs">file a bug</a>.
+</p>
+
+<h4 id="multiple-devices">
+ Deploying to multiple devices
+</h4>
+
+<p>
+ Instant Run uses different techniques to perform hot, warm, and cold swaps
+ that are specific to the API level of the target device. For this reason,
+ while deploying an app to multiple devices at once, Android Studio
+ temporarily turns off Instant Run.
+</p>
+
+<h4 id="ir-multidex">
+ Multidexing your app
+</h4>
+
+<p>
+ If your project is configured for <a href=
+ "{@docRoot}tools/building/multidex.html#mdex-pre-l">Legacy Multidex</a>—that
+ is, when <code>build.gradle</code> is configured with <code>multiDexEnabled
+ true</code> and <code>minSdkVersion 20</code> or lower—and you deploy to
+ target devices running Android 4.4 (API level 20) or lower, Android Studio
+ disables Instant Run.
+</p>
+
+<p>
+ If <code>minSdkVersion</code> is set to 21 or higher, Instant Run
+ automatically configures your app for multidex. Because Instant Run only
+ works with the debug version of your app, you may need to <a href=
+ "{@docRoot}tools/building/multidex.html#mdex-gradle">configure your app for
+ multidex</a> when deploying your release build variant.
+</p>
+
+<h4 id="instrumented-tests">
+ Running instrumented tests and performance profilers
+</h4>
+
+<p>
+ Instrumented tests load both the debug APK and a test APK into the same
+ process on a test device, allowing control methods to override the normal
+ lifecycle of the app and perform tests. While running or debugging
+ instrumented tests, Android Studio does not inject the additional methods
+ required for Instant Run and turns the feature off.
+</p>
+
+<p>
+ While profiling an app, you should disable Instant Run. There is a small
+ performance impact when using Instant Run and a slightly larger impact when
+ overriding methods with a hot swap. This performance impact could interfere
+ with information provided by performance profiling tools. Additionally, the
+ stub methods generated with each hot swap can complicate stack traces.
+</p>
+
+<h4 id="plugins">
+ Using third-party plugins
+</h4>
+
+<p>
+ Android Studio temporarily disables the Java Code Coverage Library (JaCoCo)
+ and ProGuard while using Instant Run. Because Instant Run only works with
+ debug builds, this does not affect your release build.
+</p>
+
+<p>
+ Certain third-party plugins that perform bytecode enhancement may cause
+ issues with how Instant Run instruments your app. If you experience these
+ issues, but want to continue using Instant Run, you should disable those
+ plugins for your debug build variant. You can also help improve compatibility
+ with third-party plugins by <a class="external-link" href=
+ "http://tools.android.com/filing-bugs">filing a bug</a>.
+</p>
+
+<h4 id="multi-process-apps">
+ Pushing changes to multi-process apps
+</h4>
+
+<p>
+ Instant Run only instruments your app's main process in order to perform hot
+ swaps and warm swaps. When pushing code changes to other app processes, such
+ as changes to a method implementation or an existing resource, Instant Run
+ performs a <a href="#cold-swap">cold swap</a>.
+</p>
+
+<h4 id="disable-ir">
+ Disabling Instant Run
+</h4>
+
+<p>
+ To disable Instant Run:
+</p>
+
+<ol>
+ <li>Open the <strong>Settings</strong> or <strong>Preferences</strong>
+ dialog.
+ </li>
+
+ <li>Navigate to <strong>Build, Execution, Deployment</strong> >
+ <strong>Instant Run</strong>.
+ </li>
+
+ <li>Uncheck the box next to <strong>Enable Instant Run</strong>.
+ </li>
+</ol>
\ No newline at end of file
diff --git a/docs/html/tools/building/multidex.jd b/docs/html/tools/building/multidex.jd
index e441a7c..7d05fb9 100644
--- a/docs/html/tools/building/multidex.jd
+++ b/docs/html/tools/building/multidex.jd
@@ -1,4 +1,4 @@
-page.title=Building Apps with Over 65K Methods
+page.title=Building Apps with Over 64K Methods
page.tags="65536","references","max","65k","dex","64k","multidex","multi-dex","methods"</p>
@jd:body
@@ -8,14 +8,14 @@
<h2>In this document</h2>
<ol>
<li><a href="#about">
- About the 65K Reference Limit</a>
+ About the 64K Reference Limit</a>
<ol>
<li><a href="#mdex-pre-l">Multidex support prior to Android 5.0</a></li>
<li><a href="#mdex-on-l">Multidex support for Android 5.0 and higher</a></li>
</ol>
</li>
<li><a href="#avoid">
- Avoiding the 65K Limit</a></li>
+ Avoiding the 64K Limit</a></li>
<li><a href="#mdex-gradle">
Configuring Your App for Multidex with Gradle</a>
<ol>
@@ -82,45 +82,71 @@
</p>
-<h2 id="about">About the 65K Reference Limit</h2>
+<h2 id="about">About the 64K Reference Limit</h2>
<p>
- Android application (APK) files contain executable bytecode files in the form of <a href=
- "https://source.android.com/devices/tech/dalvik/">Dalvik</a> Executable (DEX) files, which
- contain the compiled code used to run your app. The Dalvik Executable specification limits the
- total number of methods that can be referenced within a single DEX file to 65,536, including
- Android framework methods, library methods, and methods in your own code. Getting past this limit
- requires that you configure your app build process to generate more than one DEX file, known as a
- <em>multidex</em> configuration.
+ Android application (APK) files contain executable bytecode files in the form
+ of <a href="https://source.android.com/devices/tech/dalvik/">Dalvik</a>
+ Executable (DEX) files, which contain the compiled code used to run your app.
+ The Dalvik Executable specification limits the total number of methods that
+ can be referenced within a single DEX file to 65,536—including Android
+ framework methods, library methods, and methods in your own code. In the
+ context of computer science, the term <a class="external-link" href=
+ "https://en.wikipedia.org/wiki/Kilo-"><em>Kilo, K</em></a>, denotes 1024 (or
+ 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the
+ '64K reference limit'.
</p>
+<p>
+ Getting past this limit requires that you configure your app build process to
+ generate more than one DEX file, known as a <em>multidex</em> configuration.
+</p>
<h3 id="mdex-pre-l">Multidex support prior to Android 5.0</h3>
<p>
- Versions of the platform prior to Android 5.0 use the Dalvik runtime for executing app code. By
- default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around
- this limitation, you can use the <a href="{@docRoot}tools/support-library/features.html#multidex">
- multidex support library</a>, which becomes part of the primary DEX file of your app and then
+ Versions of the platform prior to Android 5.0 (API level 21) use the Dalvik
+ runtime for executing app code. By default, Dalvik limits apps to a single
+ classes.dex bytecode file per APK. In order to get around this limitation,
+ you can use the <a href=
+ "{@docRoot}tools/support-library/features.html#multidex">multidex support
+ library</a>, which becomes part of the primary DEX file of your app and then
manages access to the additional DEX files and the code they contain.
</p>
+<p class="note">
+ <strong>Note:</strong> If your project is configured for multidex with
+ <code>minSdkVersion 20</code> or lower, and you deploy to target devices
+ running Android 4.4 (API level 20) or lower, Android Studio disables <a href=
+ "{@docRoot}tools/building/building-studio.html#instant-run">Instant Run</a>.
+</p>
<h3 id="mdex-on-l">Multidex support for Android 5.0 and higher</h3>
<p>
- Android 5.0 and higher uses a runtime called ART which natively supports loading multiple dex
- files from application APK files. ART performs pre-compilation at application install time which
- scans for classes(..N).dex files and compiles them into a single .oat file for execution by the
- Android device. For more information on the Android 5.0 runtime, see <a href=
- "https://source.android.com/devices/tech/dalvik/art.html">Introducing ART</a>.
+ Android 5.0 (API level 21) and higher uses a runtime called ART which
+ natively supports loading multiple dex files from application APK files. ART
+ performs pre-compilation at application install time which scans for
+ classes(..N).dex files and compiles them into a single .oat file for
+ execution by the Android device. For more information on the Android 5.0
+ runtime, see <a href=
+ "https://source.android.com/devices/tech/dalvik/art.html">Introducing
+ ART</a>.
</p>
+<p class="note">
+ <strong>Note:</strong> While using <a href=
+ "{@docRoot}tools/building/building-studio.html#instant-run">Instant Run</a>,
+ Android Studio automatically configures your app for multidex when your app's
+ <code>minSdkVersion</code> is set to 21 or higher. Because Instant Run only
+ works with the debug version of your app, you still need to configure your
+ release build for multidex to avoid the 64K limit.
+</p>
-<h2 id="avoid">Avoiding the 65K Limit</h2>
+<h2 id="avoid">Avoiding the 64K Limit</h2>
<p>
- Before configuring your app to enable use of 65K or more method references, you should take steps
+ Before configuring your app to enable use of 64K or more method references, you should take steps
to reduce the total number of references called by your app code, including methods defined by
your app code or included libraries. The following strategies can help you avoid hitting the dex
reference limit:
@@ -173,8 +199,9 @@
</ul>
<p>
- Modify your app Gradle build file configuration to include the support library and enable
- multidex output, as shown in the following Gradle build file snippet:
+ Modify the module-level <code>build.gradle</code> file configuration to
+ include the support library and enable multidex output, as shown in the
+ following code snippet:
</p>
<pre>
@@ -199,13 +226,6 @@
}
</pre>
-<p class="note">
- <strong>Note:</strong> You can specify the <code>multiDexEnabled</code> setting in the
- <code>defaultConfig,</code> <code>buildType</code>, or <code>productFlavor</code> sections of
- your Gradle build file.
-</p>
-
-
<p>
In your manifest add the {@link android.support.multidex.MultiDexApplication} class from the
multidex support library to the application element.
@@ -444,7 +464,7 @@
dependencies {
androidTestCompile('com.android.support:multidex-instrumentation:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
- }
+ }
}
</pre>
</p>
diff --git a/docs/html/tools/help/app-link-indexing.jd b/docs/html/tools/help/app-link-indexing.jd
index 611373a..5b76059 100644
--- a/docs/html/tools/help/app-link-indexing.jd
+++ b/docs/html/tools/help/app-link-indexing.jd
@@ -1,4 +1,4 @@
-page.title=Deep Link and App Indexing API Support in Android Studio
+page.title=Supporting URLs and App Indexing in Android Studio
parent.title=Tools
parent.link=index.html
page.tags=app indexing
@@ -9,11 +9,13 @@
<h2>In this document</h2>
<ol>
<li><a href="#workflow">Typical Workflow</a></li>
- <li><a href="#intent">Adding an Intent Filter for Deep Linking and Google Search</a></li>
+ <li><a href="#intent">Adding an Intent Filter for URL Support and Google Search</a></li>
<li><a href="#indexing">Adding App Indexing API Skeleton Code to an Activity</a></li>
- <li><a href="#testintent">Testing a Deep Link</a></li>
+ <li><a href="#testintent">Testing a URL</a></li>
<li><a href="#testindexing">Viewing App Indexing API Messages in the logcat Monitor</a></li>
<li><a href="#lint">Configuring Lint</a></li>
+ <li><a href="#appindexingtest">Performing a Google App Indexing Test</a></li>
+
</ol>
<h2>See also</h2>
@@ -48,15 +50,16 @@
</div>
</div>
-<p>Android Studio helps you add deep links, app indexing, and search functionality to your apps.
+<p>Android Studio helps you add support for URLs, app indexing, and search
+functionality to your apps.
These features can help to drive more traffic to your
app, discover which app content is used most, make it easier for users to find content in an
installed app, and attract new users.</p>
<h2 id="workflow">Typical Workflow</h2>
-<p>To use Android Studio to add deep link, app indexing, and search features to your app, follow
- these basic steps:</p>
+<p>To use Android Studio to add support for URL, app indexing, and search
+features to your app:</p>
<ol>
<li>Add intent filters and code to handle incoming intents.</li>
@@ -64,23 +67,25 @@
<li>Add App Indexing API code.</li>
</ol>
-<p>Intent filters and the App Indexing API are ways to implement deep links and app indexing, but
+<p>Intent filters and the App Indexing API are ways to implement URL support
+and app indexing, but
there are other possible implementations as well. See
<a href="https://developers.google.com/app-indexing/reference/deeplinks"
class="external-link">Alternate Android Indexing Methods</a>
for more information.</p>
-<h3 id="aboutintent">Intent filters for deep links</h3>
+<h3 id="aboutintent">Intent filters for URLs</h3>
<p>Android Studio can create a basic intent filter in your manifest that you can customize to
- define deep link URLs for your app. You can then write Java code in an activity to handle the
+ define URLs for your app. You can then write Java code in an activity to handle the
intent. This implementation lets users directly open the specified app activity by
- clicking a deep link. Users can see the deep links in google.com in a browser, in the
+ clicking a URL. Users can see the URLs in google.com in a browser, in the
Google Search app, and in Google Now on Tap. </p>
-<h3 id="aboutassociation">Website association with deep links</h3>
+<h3 id="aboutassociation">Website association with URLs</h3>
-<p>After setting up deep links for your app, you can associate your website with your app by using
+<p>After setting up URL support for your app, you can associate your website
+with your app by using
the Google Search Console and Google Play Developer Console. Afterward, Google indexes your app
for URLs defined in
your intent filters and begins to include them in search results. In addition, you can optionally
@@ -91,11 +96,11 @@
<p>As an alternative to associating your app with a website,
for Android 6.0 (API level 23) and higher, you can add
<a href="{@docRoot}training/app-links/index.html"
- >default handlers and verification for deep links</a>
+ >default handlers and verification for URLs</a>
instead.</p>
-<p>Chrome displaying google.com serves search results with deep links that are accessible to both
- signed-in users and those who aren't. Google Search app users must be signed in to see deep links
+<p>Chrome displaying google.com serves search results with URLs that are accessible to both
+ signed-in users and those who aren't. Google Search app users must be signed in to see URLs
in their search results. </p>
<h3 id="aboutapi">App Indexing API code in activities</h3>
@@ -108,24 +113,27 @@
class="external-link">Googlebot</a>
can’t get content from your app.</p>
-<h3 id="abouttest">Deep link and App Indexing API testing</h3>
+<h3 id="abouttest">URL support and App Indexing API testing</h3>
<p>Android Studio helps you test your code with the following features:</p>
<ul>
-<li>Deep link testing helps you verify that a specified deep link can launch an app. </li>
+<li>URL support testing helps you verify that a specified URL can launch an app.
+</li>
<li>The logcat Monitor helps you test App Indexing API calls in an activity. </li>
-<li>The Android Lint tool has warnings for certain issues involving deep links and the App Indexing
+<li>The Android Lint tool has warnings for certain issues involving URL support
+and the App Indexing
API. These warnings and errors appear in the Code Editor and in Lint inspection results.</li>
+ <li>A Google App Indexing test checks whether Google can index a URL by
+ either crawling your app page or using the App Indexing API.</li>
</ul>
-<p>The details for implementing deep links and app indexing are described next.
+<p>The details for implementing URL support and app indexing are described next.
-<h2 id="intent">Adding an Intent Filter for Deep Linking and Google Search</h2>
+<h2 id="intent">Adding an Intent Filter for URL Support and Google Search</h2>
-<p>To use Android Studio features to add an intent filter defining a deep link, follow these
- steps:</p>
+<p>To use Android Studio features to add an intent filter defining a URL:</p>
<ol>
<li>In the <a href="{@docRoot}sdk/installing/create-project.html#ProjectView">Android view</a>
@@ -138,11 +146,11 @@
style="vertical-align:sub;margin:0;height:17px" alt="Lightbulb icon" /> appears. Click
<img src="{@docRoot}images/tools/ai-ilightbulb.png"
style="vertical-align:sub;margin:0;height:17px" alt="Lightbulb icon" />
- and select <strong>Create Deep Link</strong>.</li>
+ and select <strong>Create URL</strong>.</li>
<li>Right-click in an <code><activity></code> element and select <strong>Generate</strong>
- > <strong>Deep Link</strong>.</li>
+ > <strong>URL</strong>.</li>
<li>Place your cursor in an activity, and then select <strong>Code</strong> >
- <strong>Generate</strong> > <strong>Deep Link</strong>.</li>
+ <strong>Generate</strong> > <strong>URL</strong>.</li>
</ul>
<p>The Code Editor adds skeleton code using the
@@ -154,7 +162,7 @@
<p>The Code Editor adds an intent filter similar to the following:</p>
<pre>
<!-- ATTENTION: This intent was auto-generated. Follow instructions at
- https://g.co/AppIndexing/AndroidStudio to publish your Android app deep links. -->
+ https://g.co/AppIndexing/AndroidStudio to publish your URLs. -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@@ -177,19 +185,20 @@
<p>We recommend that you define a <code><data></code> element that supports URLs that you’ll
add in the future. In the previous sample code, for example, Google will index any URLs starting
- with <code>www.example.com/gizmos</code>. Also, remember to
- include a deep link for your app home screen so it’s included in search results. </p>
+ with <code>http://www.example.com/gizmos</code>. Also, remember to
+ include a URL for your app home screen so it’s included in search results. </p>
-<p>Deep link URLs can be the same as the URLs of the comparable pages on your website.</p>
+<p>The URLs you specify in your intent filters can be the same as the URLs of
+the comparable pages on your website.</p>
<li>In the corresponding activity,
<a href="{@docRoot}training/app-indexing/deep-linking.html#handling-intents">add Java code</a>
to read data from the intent filter and direct the app to respond accordingly. </li>
-<li><a href="#testintent">Test your deep link</a>.</li>
+<li><a href="#testintent">Test your URL</a>.</li>
</ol>
-<p>To support Google Search for your deep links, follow these steps:</p>
+<p>To support Google Search for your URLs:</p>
<ol>
<li><a href="https://developers.google.com/app-indexing/android/app#declare-a-website-association"
class="external-link">Define an association</a>
@@ -198,7 +207,7 @@
<a href="{@docRoot}training/app-links/index.html">link default handling and verification</a>.</p>
<li>Optionally
<a href="https://developers.google.com/app-indexing/android/app#create-the-noindexxml-file"
- class="external-link">exclude app URLs</a>
+ class="external-link">exclude certain URLs</a>
from the Google index.</li>
<li>Optionally <a href="#indexing">add App Indexing API code</a> to support additional search
features.</li>
@@ -207,27 +216,28 @@
<p>To test and debug your links, you can use the following Android Studio features:</p>
<ul>
-<li><a href="#testintent">Launch your deep link</a> in Android Studio to test that it works.</li>
+<li><a href="#testintent">Launch your URL</a> in Android Studio to test that it works.</li>
<li><a href="#lint">Enable the following Android Lint categories</a>:</li>
<ul>
-<li><strong>Missing Support for Google App Indexing</strong></li>
-<li><strong>Incorrect Usage of App Link for Google App Indexing</strong></li>
+<li><strong>Missing support for Google App Indexing</strong></li>
+<li><strong>URL not supported by app for Google App Indexing</strong></li>
</ul>
+<li><a href="#appindexingtest">Perform a Google App Indexing Test</a>.</li>
</ul>
<p>In addition, you can
<a href="https://developers.google.com/app-indexing/android/test#preview-your-apk-on-search-console"
class="external-link">preview your APK in the Google Search Console</a>
- to test your deep links, whether the app is associated with a website or not. </p>
+ to test your URLs, whether the app is associated with a website or not. </p>
<h2 id="indexing">Adding App Indexing API Skeleton Code to an Activity</h2>
-<p>After adding deep links, you can add App Indexing API code to an activity to support additional
- search features. </p>
+<p>After adding URL support to your app, you can add App Indexing API code to
+an activity to support additional search features. </p>
-<p>To add App Indexing API code to an activity, follow these steps:</p>
+<p>To add App Indexing API code to an activity:</p>
<ol>
<li>In <a href="{@docRoot}sdk/installing/create-project.html#ProjectView">Android view</a>
in the <em>Project</em> window, double-click the activity Java file to open it in the
@@ -297,9 +307,9 @@
// this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
- Uri.parse("http://host/path"),
- // TODO: Make sure this auto-generated app deep link URI is correct.
- Uri.parse("android-app://com.example/http/host/path")
+ Uri.parse("http://www.example.com/gizmos"),
+ // TODO: Make sure this auto-generated app URL is correct.
+ Uri.parse("android-app://com.example/http/www.example.com/gizmos")
);
AppIndex.AppIndexApi.start(client, viewAction);
}
@@ -317,9 +327,9 @@
// this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
- Uri.parse("http://host/path"),
- // TODO: Make sure this auto-generated app deep link URI is correct.
- Uri.parse("android-app://com.example/http/host/path")
+ Uri.parse("http://www.example.com/gizmos"),
+ // TODO: Make sure this auto-generated app URL is correct.
+ Uri.parse("android-app://com.example/http/www.example.com/gizmos")
);
AppIndex.AppIndexApi.end(client, viewAction);
client.disconnect();
@@ -363,7 +373,9 @@
<ul>
<li><a href="#testindexing">Examine logcat Monitor Messages</a>.</li>
<li><a href="#lint">Enable the following Android Lint category</a>:
- <strong>Missing Support for Google App Indexing API</strong></li>
+ <strong>Missing support for Google App Indexing API</strong></li>
+
+<li><a href="#appindexingtest">Perform a Google App Indexing Test</a>.</li>
</ul>
<p>In addition, you can
@@ -371,12 +383,12 @@
class="external-link">preview your APK in the Google Search Console</a>.</p>
-<h2 id="testintent">Testing a Deep Link</h2>
+<h2 id="testintent">Testing a URL</h2>
-<p>When you run your app from Android Studio, you can specify a deep link to launch so you can
+<p>When you run your app from Android Studio, you can specify a URL to launch so you can
test it.</p>
-<p>To launch a deep link from Android Studio, follow these steps:</p>
+<p>To launch a URL from Android Studio:</p>
<ol>
<li>In Android Studio, open your project in
<a href="{@docRoot}sdk/installing/create-project.html#ProjectView">Android view</a>.</li>
@@ -385,14 +397,14 @@
<li>In the <em>Run/Debug Configurations</em> dialog, beneath <strong>Android Application,</strong>
select the module you want to test.</li>
<li>Select the <strong>General</strong> tab. </li>
-<li>In the <strong>Launch</strong> field, select <strong>Deep Link</strong>. </li>
-<li>In the <strong>Deep Link</strong> field, click <strong>…</strong> to select from a list of
- defined deep links.</li>
+<li>In the <strong>Launch</strong> field, select <strong>URL</strong>. </li>
+<li>In the <strong>URL</strong> field, click <strong>…</strong> to select from a list of
+ defined URLs.</li>
<p>Or type the URL you want to test, for example, <code>http://example.com/gizmos</code>. </p>
<li>Click <strong>OK</strong>.</li>
<li>Select <strong>Run</strong> > <strong>Run app</strong> or <strong>Debug app</strong>.</li>
-<li>If the <em>Device Chooser</em> dialog appears, select a connected device or an
+<li>If the <em>Select Deployment Target</em> dialog appears, select a connected device or an
emulator, and click <strong>OK</strong>.</li>
<p>If the link is successful, the app launches in the device or emulator, and displays the app at
@@ -411,12 +423,12 @@
<p>The logcat Monitor can display app indexing log messages to determine if your App Indexing API
code is pushing the correct data to the cloud. For example, you can check the app title and the
- URL. The logcat Monitor is part of Android Monitor in Android Studio. </p>
+ URL. The logcat Monitor is part of Android Monitor in Android Studio.</p>
-<p>Follow these steps:</p>
+<p>To view App Indexing API messages in the logcat Monitor:</p>
<ol>
-<li>Run your app in Android Studio so it <a href="#testintent">launches a deep link</a>.</li>
-<li><a href="{@docRoot}tools/help/android-monitor.html#displaying">Display Android Monitor</a>
+<li>Run your app in Android Studio so it <a href="#testintent">launches a URL</a>.</li>
+<li><a href="{@docRoot}tools/help/am-logcat.html#running">Display Android Monitor</a>
and click the <strong>logcat</strong> tab.</li>
<li><a href="{@docRoot}tools/help/am-logcat.html#level">Set the log level</a> to
<strong>Verbose</strong>.</li>
@@ -445,10 +457,10 @@
<h2 id="lint">Configuring Lint</h2>
-<p>You can use the Android Studio built-in Lint tool to check whether you have valid deep links
+<p>You can use the Android Studio built-in Lint tool to check whether you have valid URLs
defined in the manifest and have implemented the App Indexing API correctly in activities.</p>
-<p>You can view deep link and app indexing warnings and errors in two ways: </p>
+<p>You can view URL and app indexing warnings and errors in two ways: </p>
<ul>
<li>As pop-up text in the Code Editor. When Lint finds a problem, it highlights the problematic
code in yellow, or underlines the code in red for more serious issues.</li>
@@ -458,7 +470,7 @@
-<p>To set default Lint checks for deep links and the App Indexing API, follow these steps:</p>
+<p>To set default Lint checks for URLs and the App Indexing API:</p>
<ol>
<li>In Android Studio, open your project in
<a href="{@docRoot}sdk/installing/create-project.html#ProjectView">Android view</a>.
@@ -472,25 +484,24 @@
respectively. </li>
<li>Expand the <strong>Android Lint</strong> category and change the Lint settings as needed:</li>
<ul>
-<li><strong>Missing Support for Google App Indexing</strong> - Reports a warning if the app hasn’t
- implemented deep links, which are used by Google Search. This warning setting is enabled by
+<li><strong>Missing support for Google App Indexing</strong> - Reports a warning if the app hasn’t
+ implemented URLs, which are used by Google Search. This warning setting is enabled by
default.</li>
-<li><strong>Missing Support for Google App Indexing API</strong> - Reports if an app hasn’t
+<li><strong>Missing support for Google App Indexing API</strong> - Reports if an app hasn’t
implemented the App Indexing API at all. This warning setting is disabled by default.</li>
-<li><strong>Incorrect Usage of App Link for Google App Indexing</strong> - Reports deep link
+<li><strong>URL not supported by app for Google App Indexing</strong> - Reports URL
errors in manifest code. This error setting is enabled by default.</li>
</ul>
<p>For example, the following Lint warning appears for the first setting:</p>
-<p><img src="{@docRoot}images/tools/ai-lint.png" /></p>
+<p><img src="{@docRoot}images/tools/ai-lint.png" alt="Lint warning" /></p>
<li>Click <strong>OK</strong>.</li>
</ol>
-<p>To produce a list of Lint checks displayed in the <em>Inspection Results</em> window,
- follow these steps:</p>
+<p>To produce a list of Lint checks displayed in the <em>Inspection Results</em> window:</p>
<ol>
<li>In Android Studio, open your project in
<a href="{@docRoot}sdk/installing/create-project.html#ProjectView">Android view</a>
@@ -504,7 +515,7 @@
dialog, optionally click <strong>Manage</strong> to define a new profile, specify the Lint
settings you want, and then click <strong>OK</strong>.</li>
<p>In the <em>Inspections</em> dialog, you can search for the string "app indexing"
-to find the deep link and App Indexing API Lint checks. Note that changing Lint settings for a
+to find the URL and App Indexing API Lint checks. Note that changing Lint settings for a
profile in the <em>Inspections</em> dialog doesn’t change the default settings, as described in
the previous procedure. It does change the settings for profiles displayed in the
<em>Inspections</em> dialog, however.</p>
@@ -512,3 +523,87 @@
<p>The results appear in the <em>Inspection Results</em> window.</p>
</ol>
+
+
+<h2 id="appindexingtest">Performing a Google App Indexing Test</h2>
+
+<p>You can use a Google App Indexing Test to check whether Google can index
+a URL by either crawling your app page or using the App Indexing API.
+Google can index the URL if your app supports at least one of the following:
+</p>
+<ul>
+<li>Googlebot can open and crawl the page identified by the URL.</li>
+<li>Your app sends the correct data by using the App Indexing API.</li>
+</ul>
+
+<p>To perform a Google App Indexing Test: </p>
+<ol>
+<li>Add <a href="#intent">URL</a> and
+<a href="#indexing">App Indexing API</a> support to your app.
+</li>
+<li>While your project is open in Android Studio, select <strong>Tools</strong>
+> <strong>Android</strong> > <strong>Google App Indexing Test</strong>.
+</li>
+<li>In the <em>Google App Indexing Test</em> dialog, select a
+<strong>Module</strong>, <strong>URL</strong>, and <strong>Language</strong>.
+</li>
+<li>Log in if you see a message asking you to log into a Google Cloud Platform
+account.</li>
+<li>In the <em>Google App Indexing Test</em> dialog, click <strong>OK</strong>.
+</li>
+
+<p>Android Studio builds the APK and starts the test. The test can take a few
+minutes to complete. The results appear in a new tab in the Code Editor.</p>
+<p><img src="{@docRoot}images/tools/ai-appindexingtest.png"
+alt="Google App Indexing Test results" /></p>
+
+<p>If the app preview on the right shows the screen that corresponds to the URL
+you're testing, then Googlebot can find the URL.</p>
+
+<li>Correct any issues the test identifies, and repeat the test as often as
+needed.</li>
+</li>
+</ol>
+
+<p>The following table lists common errors and warnings you might encounter.</p>
+
+<table>
+ <tr>
+ <th scope="col">Warning or Error</th>
+ <th scope="col">Description</th>
+ </tr>
+
+ <tr>
+ <td>Error: Google cannot index this page.</td>
+ <td>Your app can't be crawled by Googlebot or using the App Indexing API,
+ so Google isn't able to index this app.</td>
+ </tr>
+ <tr>
+ <td>Warning: The App URL you sent by using the App Indexing API doesn't
+ match the URL opened.</td>
+ <td>When calling the App Indexing API, the URL specified in the app must
+ match the opened URL.</td>
+ </tr>
+ <tr>
+ <td>Warning: Google cannot index this page using the App Indexing API
+ because the title is empty.</td>
+ <td>When calling the App Indexing API, the title shouldn't be empty.</td>
+ </tr>
+ <tr>
+ <td>Warning: Google can index this page using Googlebot crawling but
+ identified blocked resources.</td>
+ <td>The app references other resources, and some of them are blocked or
+ temporarily unavailable. If these resources aren't critical, it might not
+ matter. Check the preview on the right to see whether the content
+ displays correctly. To fix this issue, make sure the resources aren't
+ blocked by <a href="https://support.google.com/webmasters/answer/6062608"
+ class="external-link"><code>robots.txt</code></a>.</td>
+ </tr>
+ <tr>
+ <td>Warning: Google cannot index this page using the App Indexing API.</td>
+ <td>Your app isn’t using the App Indexing API. We recommended adding App
+ Indexing API support to your app.</td>
+ </tr>
+
+</table>
+
diff --git a/docs/html/tools/performance/index.jd b/docs/html/tools/performance/index.jd
index fa5af86..299b05e 100644
--- a/docs/html/tools/performance/index.jd
+++ b/docs/html/tools/performance/index.jd
@@ -22,6 +22,17 @@
visualize the rendering, compute, memory, and battery performance of your
app.</p>
+<p class="note">
+ <strong>Note:</strong> While profiling an app, you should <a href=
+ "{@docRoot}tools/building/building-studio.html#disable-ir">disable Instant
+ Run</a>. There is a small performance impact when <a href=
+ "{@docRoot}tools/building/building-studio.html#instant-run">using Instant
+ Run</a> and a slightly larger impact when updating methods. This
+ performance impact could interfere with information provided by performance
+ profiling tools. Additionally, the stub methods generated while using the
+ feature can complicate stack traces.
+</p>
+
<h2 id="rendering-tools">Rendering Analysis Tools</h2>
<p>Visualize the rendering behavior and performance of your app.</p>
diff --git a/docs/html/tools/revisions/gradle-plugin.jd b/docs/html/tools/revisions/gradle-plugin.jd
index 540bbcd..6a35cab 100644
--- a/docs/html/tools/revisions/gradle-plugin.jd
+++ b/docs/html/tools/revisions/gradle-plugin.jd
@@ -3,42 +3,249 @@
@jd:body
<div id="qv-wrapper">
-<div id="qv">
+ <div id="qv">
+ <h2>
+ In this document
+ </h2>
- <h2>See also</h2>
- <ol>
- <li><a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a></li>
- <li><a href="{@docRoot}tools/building/plugin-for-gradle.html">Android Plugin for Gradle</a></li>
- </ol>
+ <ol>
+ <li>
+ <a href="#updating-plugin">Updating the Android Plugin for Gradle
+ Version</a>
+ </li>
-</div>
+ <li>
+ <a href="#updating-gradle">Updating the Gradle Version</a>
+ </li>
+
+ <li>
+ <a href="#revisions">Revisions</a>
+ </li>
+ </ol>
+
+ <h2>
+ See also
+ </h2>
+
+ <ol>
+ <li>
+ <a href="{@docRoot}sdk/installing/studio-build.html">Build System
+ Overview</a>
+ </li>
+
+ <li>
+ <a href="{@docRoot}tools/building/plugin-for-gradle.html">Android
+ Plugin for Gradle</a>
+ </li>
+ </ol>
+ </div>
</div>
+<p>
+ The Android build system uses the Android Plugin for Gradle to support
+ building Android applications with the <a href=
+ "http://www.gradle.org/">Gradle</a> build toolkit. The plugin runs
+ independent of Android Studio so the plugin and the Gradle build system can
+ be updated independently of Android Studio.
+</p>
-<p>The Android build system uses the Android Plugin for Gradle to support building Android
-applications with the <a href="http://www.gradle.org/">Gradle</a> build toolkit. The plugin runs
-independent of Android Studio so the plugin and the Gradle build system can be updated
-independently of Android Studio.</p>
+<h2 id="updating-plugin">
+ Updating the Android Plugin for Gradle
+</h2>
-<p class="note"><strong>Note:</strong> When you update Android Studio or open a project in a
-previous version of Android Studio, Android Studio prompts you to automatically update the plugin
-and Gradle to the latest available versions. You can choose to accept these updates based
-on your project's build requirements. </p>
+<p>
+ When you update Android Studio, you may receive a prompt to automatically
+ update the Android Plugin for Gradle to the latest available version. You
+ can choose to accept the update or manually specify a version based on
+ your project's build requirements.
+</p>
+<p>
+ You can specify the <a href=
+ "{@docRoot}tools/building/plugin-for-gradle.html">Android Plugin for
+ Gradle</a> version in either the <strong>File</strong> > <strong>Project
+ Structure</strong> > <strong>Project</strong> menu in Android Studio, or
+ the top-level <code>build.gradle</code> file. The plugin version applies to
+ all modules built in that Android Studio project. The following example sets
+ the Android Plugin for Gradle to version 2.0.0 from the
+ <code>build.gradle</code> file:
+</p>
-<h2 id="revisions">Revisions</h2>
+<pre>
+buildscript {
+ ...
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.0.0'
+ }
+}
+</pre>
+<p class="caution">
+ <strong>Caution:</strong> You should not use dynamic dependencies in version
+ numbers, such as <code>'com.android.tools.build:gradle:2.+'</code>. Using
+ this feature can cause unexpected version updates and difficulty resolving
+ version differences.
+</p>
-<p>The sections below provide notes about successive releases of
-the Android Plugin for Gradle, as denoted by revision number. To determine what revision of the
-plugin you are using, check the version declaration in the project-level
-<strong>build.gradle</strong> file. </p>
+<p>
+ If the specified plugin version has not been downloaded, Gradle downloads it
+ the next time you build your project or click <strong>Tools</strong> >
+ <strong>Android</strong> > <strong>Sync Project with Gradle Files</strong>
+ from the Android Studio main menu.
+</p>
-<p>For a summary of known issues in Android Plugin for Gradle, see <a
-href="http://tools.android.com/knownissues">http://tools.android.com/knownissues</a>.</p>
+<h2 id="updating-gradle">
+ Updating Gradle
+</h2>
+
+<p>
+ When you update Android Studio, you may receive a prompt to automatically
+ update Gradle to the latest available version. You can choose to accept the
+ update or manually specify a version based on your project's build
+ requirements.
+</p>
+
+<p>
+ You can specify the Gradle version in either the <strong>File</strong> >
+ <strong>Project Structure</strong> > <strong>Project</strong> menu in
+ Android Studio, or by editing the Gradle distribution reference in the
+ <code>gradle/wrapper/gradle-wrapper.properties</code> file. The following
+ example sets the Gradle version to 2.10 in the
+ <code>gradle-wrapper.properties</code> file.
+</p>
+
+<pre>
+...
+distributionUrl = https\://services.gradle.org/distributions/gradle-2.10-all.zip
+...
+</pre>
+
+<h2 id="revisions">
+ Revisions
+</h2>
+
+<p>
+ For a summary of known issues in Android Plugin for Gradle, visit the
+ <a class="external-link" href="http://tools.android.com/knownissues">Android
+ Tools Project Site</a>.
+</p>
<div class="toggle-content opened">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/styles/disclosure_up.png" class="toggle-content-img"
+ alt=""/>Android Plugin for Gradle, Revision 2.0.0</a> <em>(March 2016)</em>
+ </p>
+
+ <div class="toggle-content-toggleme">
+ <dl>
+ <dt>Dependencies:</dt>
+
+ <dd>
+ <ul>
+ <li>Gradle 2.10 or higher.
+ </li>
+
+ <li>
+ <a href="{@docRoot}tools/revisions/build-tools.html">Build Tools 21.1.1</a>
+ or higher.
+ </li>
+ </ul>
+ </dd>
+
+ <dt>New:</dt>
+ <dd>
+ <ul>
+ <li>Enables <a href=
+ "{@docRoot}tools/building/building-studio.html#instant-run">Instant Run</a> by
+ supporting bytecode injection, and pushing code and resource updates to a
+ running app on the emulator or a physical device.
+ </li>
+
+ <li>Added support for incremental builds, even when the app isn’t running.
+ Full build times are improved by pushing incremental changes through the
+ <a href="{@docRoot}tools/help/adb.html">Android Debug Bridge</a> to the
+ connected device.
+ </li>
+
+ <li>Added <code>maxProcessCount</code> to control how many slave dex processes can
+ be spawned concurrently. The following code, in the module-level
+ <code>build.gradle</code> file, sets the maximum number of concurrent processes
+ to 4:
+<pre>
+android {
+ ...
+ dexOptions {
+ maxProcessCount = 4
+ }
+}
+</pre>
+ </li>
+
+ <li>Added an experimental code shrinker to support pre-dexing and reduce re-dexing
+ of dependencies, which are not supported with Proguard. This improves the build
+ speed of your debug build variant. Because the experimental shrinker does not
+ support optimization and obfuscation, you should enable Proguard for your
+ release builds. To enable the experimental shrinker for your debug builds, add
+ the following to your module-level <code>build.gradle</code> file:
+
+<pre>
+android {
+ ...
+ buildTypes {
+ debug {
+ minifyEnabed true
+ useProguard false
+ }
+ release {
+ minifyEnabed true
+ useProguard true // this is a default setting
+ }
+ }
+}
+</pre>
+ </li>
+
+ <li>Added logging support and improved performance for the resource shrinker.
+ The resource shrinker now logs all of its operations into a <code>resources.txt</code>
+ file located in the same folder as the Proguard log files.
+ </li>
+ </ul>
+ </dd>
+
+ <dt>Changed behavior:</dt>
+ <dd>
+ <ul>
+ <li>When <code>minSdkVersion</code> is set to 18 or higher, APK signing uses
+ SHA256.
+ </li>
+
+ <li>DSA and ECDSA keys can now sign APK packages.
+
+ <p class="note">
+ <strong>Note:</strong> The <a href=
+ "{@docRoot}training/articles/keystore.html">Android keystore</a> provider no
+ longer supports <a href=
+ "{@docRoot}about/versions/marshmallow/android-6.0-changes.html#behavior-keystore">
+ DSA keys on Android 6.0</a> (API level 23) and higher.
+ </p>
+
+ </li>
+ </ul>
+ </dd>
+
+ <dt>Fixed issues:</dt>
+ <dd>
+ <ul>
+ <li>Fixed an issue that caused duplicate AAR dependencies in both
+ the test and main build configurations.
+ </li>
+ </ul>
+ </dd>
+ </div>
+</div>
+
+<div class="toggle-content closed">
+ <p><a href="#" onclick="return toggleContent(this)">
+ <img src="{@docRoot}assets/images/styles/disclosure_down.png" class="toggle-content-img"
alt=""/>Android Plugin for Gradle, Revision 1.5.0</a> <em>(November 2015)</em>
</p>
@@ -546,9 +753,6 @@
</div>
</div>
-
-
-
<div class="toggle-content closed">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/styles/disclosure_down.png" class="toggle-content-img"
@@ -577,47 +781,4 @@
</ul>
</dd>
</div>
-</div>
-
-
-
-
-<h2>Updating the Android Plugin for Gradle Version</h2>
-<p>The Android Plugin for Gradle version is specified in the
-<strong>File > Project Structure > Project</strong> menu and the project-level
-<code>build.gradle</code> file. The plugin version applies to all modules built in that
-Android Studio project. This example sets the Android Plugin for Gradle to version 1.1.0 from the <code>build.gradle</code> file:
-<pre>
-...
- dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
- }
-...
-</pre>
-
-
-<p class="caution"><strong>Caution:</strong> You should not use dynamic dependencies (+) in
-version numbers. Using this feature can cause unexpected version updates and difficulty
-resolving version differences. </p>
-
-<p>If you're building with Gradle but not using Android Studio, the build process downloads the
-latest Android Plugin for Gradle when it runs. </p>
-
-
-
-<h2>Updating the Gradle Version </h2>
-
-<p>Android Studio requires Gradle version 2.2.1 or later. To view and
-update the Gradle version, edit the Gradle distribution reference in the
-<code>gradle/wrapper/gradle-wrapper.properties</code> file. This example sets the
-Gradle version to 2.2.1.</p>
-
-<pre>
-...
-distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
-...
-</pre>
-
-<p>For more details about the supported Android Plugin for Gradle properties and syntax, click
-the link to the
-<a href="{@docRoot}tools/building/plugin-for-gradle.html">Plugin Language Reference</a>.</p>
\ No newline at end of file
+</div>
\ No newline at end of file
diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs
index 3ce0d11..f737770 100644
--- a/docs/html/tools/tools_toc.cs
+++ b/docs/html/tools/tools_toc.cs
@@ -97,7 +97,7 @@
<li><a href="<?cs var:toroot ?>tools/debugging/annotations.html">
<span class="en">Improving Code Inspection with Annotations</span></a></li>
<li><a href="<?cs var:toroot ?>tools/help/app-link-indexing.html">
- <span class="en">Deep Link and App Indexing API Support</span></a></li>
+ <span class="en">Supporting URLs and App Indexing in Android Studio</span></a></li>
</ul>
</li>
@@ -251,7 +251,7 @@
<li><a href="<?cs var:toroot ?>tools/building/manifest-merge.html">
<span class="en">Manifest Merging</span></a></li>
<li><a href="<?cs var:toroot ?>tools/building/multidex.html">
- <span class="en">Apps Over 65K Methods</span></a></li>
+ <span class="en">Apps Over 64K Methods</span></a></li>
</ul>
</li><!-- end of build system -->
diff --git a/docs/html/training/app-indexing/index.jd b/docs/html/training/app-indexing/index.jd
index a1a47e9..60f40b4 100644
--- a/docs/html/training/app-indexing/index.jd
+++ b/docs/html/training/app-indexing/index.jd
@@ -22,7 +22,7 @@
target="_blank">App Indexing for Google Search</a></li>
<li><a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent
Filters</a></li>
-<li><a href="{@docRoot}tools/help/app-link-indexing.html">Deep Link and App Indexing API Support in Android Studio</a></li>
+<li><a href="{@docRoot}tools/help/app-link-indexing.html">Supporting URLs and App Indexing in Android Studio</a></li>
</ul>
</div>
</div>
diff --git a/docs/html/training/app-links/index.jd b/docs/html/training/app-links/index.jd
index 27b6480..80309ee 100644
--- a/docs/html/training/app-links/index.jd
+++ b/docs/html/training/app-links/index.jd
@@ -16,7 +16,7 @@
</ol>
<h2>See also</h2>
<ol>
- <li><a href="{@docRoot}tools/help/app-link-indexing.html">Deep Link and App Indexing API Support in Android Studio</a></li>
+ <li><a href="{@docRoot}tools/help/app-link-indexing.html">Supporting URLs and App Indexing in Android Studio</a></li>
</ol>
</div>
</div>
diff --git a/docs/html/training/testing/start/index.jd b/docs/html/training/testing/start/index.jd
index a4b4aea..74617b0 100644
--- a/docs/html/training/testing/start/index.jd
+++ b/docs/html/training/testing/start/index.jd
@@ -6,69 +6,153 @@
@jd:body
<div id="tb-wrapper">
-<div id="tb">
+ <div id="tb">
-<!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
-<h2>Dependencies and prerequisites</h2>
-<ul>
- <li><a href="{@docRoot}tools/studio/index.html">Android Studio (latest version)</a>.</li>
-</ul>
+ <h2>
+ Dependencies and prerequisites
+ </h2>
-<h2>This lesson teaches you to</h2>
-<ol>
-<li><a href="#setup">Set Up Your Testing Environment</a></li>
-<li><a href="#build">Build and Run Your Tests</a></li>
-</ol>
+ <ul>
+ <li>
+ <a href="{@docRoot}tools/studio/index.html">Android Studio 2.0</a>, or
+ later.
+ </li>
-<h2>You Should Also Read</h2>
-<ul>
-<li><a href="{@docRoot}tools/testing/testing_android.html">Testing Concepts</a></li>
-<li><a href="https://github.com/googlesamples/android-testing"
- class="external-link">Android Testing Samples</a></li>
-<li><a href="{@docRoot}about/dashboards/index.html">Android Dashboards</a></li>
-</ul>
+ <li>The Android Support Repository (available from the <a href=
+ "{@docRoot}tools/help/sdk-manager.html">SDK Manager</a>)
+ </li>
+ </ul>
-</div>
+ <h2>
+ This lesson teaches you to
+ </h2>
+
+ <ol>
+ <li>
+ <a href="#config-local-tests">Configure Your Project for Local Unit
+ Tests</a>
+ </li>
+
+ <li>
+ <a href="#config-instrumented-tests">Configure Your Project for
+ Instrumented Tests</a>
+ </li>
+
+ <li>
+ <a href="#build">Build and Run Your Tests</a>
+ <ol>
+ <li>
+ <a href="#run-local-tests">Run Local Unit Tests</a>
+ </li>
+
+ <li>
+ <a href="#run-instrumented-tests">Run Instrumented Tests</a>
+ </li>
+
+ <li>
+ <a href="#run-ctl">Run Instrumented Tests with Cloud Test Lab</a>
+ </li>
+ </ol>
+ </li>
+ </ol>
+
+ <h2>
+ See also
+ </h2>
+
+ <ul>
+ <li>
+ <a href="{@docRoot}tools/testing/testing_android.html">Testing
+ Concepts</a>
+ </li>
+
+ <li>
+ <a href="https://github.com/googlesamples/android-testing" class=
+ "external-link">Android Testing Samples</a>
+ </li>
+
+ <li>
+ <a href="https://developers.google.com/cloud-test-lab/">Cloud Test
+ Lab</a>
+ </li>
+ </ul>
+ </div>
</div>
-<p>You should be writing and running tests as part of your Android app development cycle.
-Well-written tests can help you catch bugs early in development and give you confidence in your
-code.</p>
+<p>
+ Writing and running tests are important parts of the Android app development
+ cycle. Well-written tests can help you catch bugs early in development and
+ give you confidence in your code. Using Android Studio, you can run local
+ unit tests or instrumented tests on a variety of physical or virtual Android
+ devices. You can then analyze the results and make changes to your code
+ without leaving the development environment.
+</p>
-<p>To verify specific behavior in your app, and to check for consistency across different Android
-devices, you can write a <a href="//en.wikipedia.org/wiki/Test_case"
-class="external-link">test case</a>. This lesson teaches you how to build a test case using the
-JUnit 4 framework and the testing APIs and tools provided by Google, and how to run your
-tests.</p>
+<p>
+ <em>Local unit tests</em> are tests that run on your local machine, without
+ needing access to the Android framework or an Android device. To learn how to
+ develop local units tests, see <a href=
+ "{@docRoot}training/testing/unit-testing/local-unit-tests.html">Building
+ Local Unit Tests</a>.
+</p>
-<h2 id="setup">Set Up Your Testing Environment</h2>
+<p>
+ <em>Instrumented tests</em> are tests that run on an Android device or
+ emulator. These tests have access to {@link android.app.Instrumentation}
+ information, such as the {@link android.content.Context} for the app under
+ test. Instrumented tests can be used for unit, user interface (UI), or app
+ component integration testing. To learn how to develop instrumented tests for
+ your specific needs, see these additional topics:
+</p>
-<p>Before you start writing and running your tests, you must set up your test
-development environment. Android Studio provides an integrated development environment for you to
-create, build, and run Android app test cases from a graphical user interface (GUI).</p>
-
-<p>You must first download the prerequisite Android development tools before proceeding:
<ul>
-<li><a href="{@docRoot}sdk/index.html">Android Studio</a> (latest version).</li>
-<li>The latest Android Support Repository using the
- <a href="{@docRoot}tools/help/sdk-manager.html">SDK Manager</a>. </li>
+ <li>
+ <a href=
+ "{@docRoot}training/testing/unit-testing/instrumented-unit-tests.html">Building
+ Instrumented Unit Tests</a> - Build more complex unit tests that have
+ Android dependencies which cannot be easily filled by using mock objects.
+ </li>
+
+ <li>
+ <a href="{@docRoot}training/testing/ui-testing/index.html">Automating User
+ Interface Tests</a> - Create tests to verify that the user interface
+ behaves correctly for user interactions within a single app or for
+ interactions across multiple apps.
+ </li>
+
+ <li>
+ <a href="{@docRoot}training/testing/integration-testing/index.html">Testing
+ App Component Integrations</a> - Verify the behavior of components that
+ users do not directly interact with, such as a <a href=
+ "{@docRoot}guide/components/services.html">Service</a> or a <a href=
+ "guide/topics/providers/content-providers.html">Content Provider</a>.
+ </li>
</ul>
-<p>Based on the type of test you want to create, configure the test code source location and the
- project dependencies in Android Studio as described in the following sections.</p>
+<p>
+ This lesson teaches you how to build and run your tests using using Android
+ Studio. If you are not using Android Studio, you can learn how to
+ <a href="{@docRoot}tools/testing/testing_otheride.html">run your tests from
+ the command-line</a>.
+</p>
-<h3 id="config-local-tests">Configure Your Project for Local Unit Tests</h3>
-<p><em>Local unit tests</em> are tests that run on your local machine, without needing access to the
-Android framework or an Android device. To learn how to develop local units tests, see
-<a href="{@docRoot}training/testing/unit-testing/local-unit-tests.html">
-Building Local Unit Tests</a>.</p>
-<p>In your Android Studio project, you must store the source files for local unit tests under a
-specific source directory ({@code src/test/java}). This feature improves your project organization
-by letting you group your unit tests together into a single source set.</p>
-<p>As with production code, you can create local unit tests for a
-<a href="http://developer.android.com/tools/building/configuring-gradle.html#workBuildVariants"
-class="external-link">specific flavor or build type</a>. Keep your unit tests in a test
-source tree location that corresponds to your production source tree, such as:</p>
+<h3 id="config-local-tests">
+ Configure Your Project for Local Unit Tests
+</h3>
+
+<p>
+ In your Android Studio project, you must store the source files for local
+ unit tests under a specific source directory ({@code src/test/java}). This
+ improves project organization by grouping your unit tests together into a
+ single source set.
+</p>
+
+<p>
+ As with production code, you can create local unit tests for a <a href=
+ "{@docRoot}tools/building/configuring-gradle.html#workBuildVariants">specific
+ flavor or build type</a>. Keep your unit tests in a test source tree location
+ that corresponds to your production source tree, such as:
+</p>
<table>
<tr>
@@ -89,15 +173,21 @@
</tr>
</table>
-<p>You'll need to configure the testing dependencies for your project to use the
- standard APIs provided by the JUnit 4 framework. To simplify your local unit test development,
- we recommend that you include the <a href="https://github.com/mockito/mockito"
- class="external-link">Mockito</a> library if your test needs to interact with Android
- dependencies. To learn more about using mock objects in your local unit tests, see
-<a href="{@docRoot}training/testing/unit-testing/local-unit-tests.html#mocking-dependencies">
- Mocking Android dependencies</a>.</p>
-<p>In the {@code build.gradle} file of your Android app module, specify your dependencies like
-this:</p>
+<p>
+ You'll need to configure the testing dependencies for your project to use the
+ standard APIs provided by the JUnit 4 framework. If your test needs to
+ interact with Android dependencies, include the <a href=
+ "https://github.com/mockito/mockito" class="external-link">Mockito</a>
+ library to simplify your local unit tests. To learn more about using mock
+ objects in your local unit tests, see <a href=
+ "{@docRoot}training/testing/unit-testing/local-unit-tests.html#mocking-dependencies">
+ Mocking Android dependencies</a>.
+</p>
+
+<p>
+ In your app's top-level {@code build.gradle} file, you need to specify these
+ libraries as dependencies:
+</p>
<pre>
dependencies {
@@ -108,46 +198,43 @@
}
</pre>
-<h3 id="config-instrumented-tests">Configure Your Project for Instrumented Tests</h3>
-<p><em>Instrumented tests</em> are tests that run on an Android device or emulator. These tests
-have access to {@link android.app.Instrumentation} information, such as the
-{@link android.content.Context} for the app under test. Instrumented tests can be used for unit,
-user interface (UI), or app component integration testing. To learn how to develop instrumented
-tests for your specific needs, see these additional topics:
-<ul>
-<li><a href="{@docRoot}training/testing/unit-testing/instrumented-unit-tests.html">
- Building Instrumented Unit Tests</a> - Build more complex unit tests that have Android
- dependencies which cannot be easily filled by using mock objects.</li>
-<li><a href="{@docRoot}training/testing/ui-testing/index.html">
- Automating User Interface Tests</a> - Create tests to verify that the user interface behaves
- correctly for user interactions within a single app or for interactions across multiple apps.</li>
-<li><a href="{@docRoot}training/testing/integration-testing/index.html">
- Testing App Component Integrations</a> - Verify the behavior of components that users do not
-directly interact with, such as a <a href="{@docRoot}guide/components/services.html">Service</a> or
-a <a href="guide/topics/providers/content-providers.html">Content Provider</a>.</li>
-</ul>
-</p>
+<h3 id="config-instrumented-tests">
+ Configure Your Project for Instrumented Tests
+</h3>
+
<p>
-In your Android Studio project, you must place the source code for your instrumentated tests under
-a specific directory (<code>src/androidTest/java</code>).
+ In your Android Studio project, you must place the source code for your
+ instrumentated tests under a specific directory
+ (<code>src/androidTest/java</code>).
</p>
+
<p>
-Download the Android Testing Support Library, which provides APIs that allow you to quickly build and
-run instrumented test code for your apps. The Testing Support Library includes a JUnit 4 test runner
-(<a href="{@docRoot}tools/testing-support-library/index.html#AndroidJUnitRunner">AndroidJUnitRunner
-</a>) and APIs for functional UI tests
-(<a href="{@docRoot}tools/testing-support-library/index.html#Espresso">Espresso</a> and
-<a href="{@docRoot}tools/testing-support-library/index.html#UIAutomator">UI Automator</a>). To
-learn how to install the library, see
-<a href="{@docRoot}tools/testing-support-library/index.html#setup">Testing Support Library Setup</a>.
+ <a href="{@docRoot}tools/testing-support-library/index.html#setup">Download
+ the Android Testing Support Library Setup</a>, which provides APIs that allow
+ you to quickly build and run instrumented test code for your apps. The
+ Testing Support Library includes a JUnit 4 test runner (<a href=
+ "{@docRoot}tools/testing-support-library/index.html#AndroidJUnitRunner">AndroidJUnitRunner</a>
+ ) and APIs for functional UI tests (<a href=
+ "{@docRoot}tools/testing-support-library/index.html#Espresso">Espresso</a>
+ and <a href=
+ "{@docRoot}tools/testing-support-library/index.html#UIAutomator">UI
+ Automator</a>).
</p>
-<p>You'll need to configure the Android testing dependencies for your project to use the test runner
-and the rules APIs provided by the Testing Support Library. To simplify your test development,
-we also recommend that you include the <a href="https://github.com/hamcrest"
-class="external-link">Hamcrest</a> library, which lets you create more flexible assertions using the
-Hamcrest matcher APIs.</p>
-<p>In the {@code build.gradle} file of your Android app module, specify your dependencies like
-this:</p>
+
+<p>
+ You'll need to configure the Android testing dependencies for your project to
+ use the test runner and the rules APIs provided by the Testing Support
+ Library. To simplify your test development, we also recommend that you
+ include the <a href="https://github.com/hamcrest" class=
+ "external-link">Hamcrest</a> library, which lets you create more flexible
+ assertions using the Hamcrest matcher APIs.
+</p>
+
+<p>
+ In your app's top-level {@code build.gradle} file, you need to specify these
+ libraries as dependencies:
+</p>
+
<pre>
dependencies {
androidTestCompile 'com.android.support:support-annotations:23.0.1'
@@ -162,59 +249,13 @@
}
</pre>
-<h2 id="build">Build and Run Your Tests</h2>
-
-<p>You can run build and run your tests in a similar way to how you run your Android apps --
- graphically in Android Studio or from the command-line using the
-<a href="{@docRoot}tools/building/plugin-for-gradle.html">
-Android Plugin for Gradle</a>.</p>
-
-<h3 id="run-local-tests">Run Local Unit Tests</h3>
<p>
-The Android Plugin for Gradle compiles the local unit test code located in the default directory
-({@code src/test/java}), builds a test app, and executes it locally
-using the default test runner class.
+ To use JUnit 4 test classes, make sure to specify <a href=
+ "{@docRoot}reference/android/support/test/runner/AndroidJUnitRunner.html">{@code
+ AndroidJUnitRunner}</a> as the default test instrumentation runner in your
+ project by including the following setting in your app's module-level {@code build.gradle}
+ file:
</p>
-<p>
-To run local unit tests in your Gradle project from Android Studio:
-</p>
-<ol>
-<li>In the <strong>Project</strong> window, right click on the project and synchronize your project.
-</li>
-<li>Open the <strong>Build Variants</strong> window by clicking the left-hand tab, then change the
-test artifact to <em>Unit Tests</em>.
-</li>
-<li>In the <strong>Project</strong> window, drill down to your unit test class or method,
-then right-click and run it. To run all tests in the unit test directory, select the directory then
-right-click and press <strong>Run tests</strong>.
-</li>
-</ol>
-
-<p>Android Studio displays the results of the unit test execution in the <strong>Run</strong>
-window.</p>
-
-<p>To run local unit tests in your Gradle project from the command-line, call the {@code test} task
-command.</p>
-
-<pre>
-./gradlew test
-</pre>
-
-<p>If there are failing tests, the command will display links to HTML reports (one per build
-variant). You can find the generated HTML test result reports in the
-{@code <path_to_your_project>/app/build/reports/tests/} directory, and the corresponding XML
-files in the {@code <path_to_your_project>/app/build/test-results/} directory.</p>
-
-<h3 id="run-instrumented-tests">Run Instrumented Tests</h3>
-<p>
-The Android Plugin for Gradle compiles the instrumented test code located in the default directory
-({@code src/androidTest/java}), builds a test APK and production APK, installs both APKs on the
-connected device or emulator, and executes the tests.</p>
-
-<p>Make sure to specify
-<a href="{@docRoot}reference/android/support/test/runner/AndroidJUnitRunner.html">
-{@code AndroidJUnitRunner}</a> as the default test instrumentation runner in your project. To do
-this, add the following setting in your {@code build.gradle} file:</p>
<pre>
android {
@@ -224,29 +265,257 @@
}
</pre>
-<p>To run your instrumented tests in Android Studio:</p>
+<h2 id="build">
+ Build and Run Your Tests
+</h2>
+
+<p>
+ Android Studio provides all the tools you need to build, run, and analyze
+ your tests within the development environment. You can also run instrumented
+ tests on multiple device configurations, simultaneously, using <a href=
+ "https://developers.google.com/cloud-test-lab/">Cloud Test Lab</a>
+ integration.
+</p>
+
+<p class="note">
+ <strong>Note:</strong> While running or debugging instrumented tests,
+ Android Studio does not inject the additional methods required for <a href=
+ "{@docRoot}tools/building/building-studio.html#instant-run">Instant Run</a>
+ and turns the feature off.
+</p>
+
+<h3 id="run-local-tests">
+ Run Local Unit Tests
+</h3>
+
+<p>
+ To run your local unit tests:
+</p>
+
<ol>
-<li>Open the <strong>Build Variants</strong> window by clicking the left-hand tab, then set the
-test artifact to <em>Android Instrumentation Tests</em>.
-</li>
-<li>In the <strong>Project</strong> window, drill down to your instrumented test class or method,
- then right-click and run it using the Android Test configuration. To run all tests in the
-instrumented test directory, select the directory then right-click and press
-<strong>Run tests</strong>.
-</li>
+ <li>In the <em>Project</em> window, right click on the project and
+ synchronize your project.
+ </li>
+
+ <li>Open the <em>Build Variants</em> window by clicking the left-hand tab,
+ then change the test artifact to <em>Unit Tests</em>.
+ </li>
+
+ <li>In the <em>Project</em> window, navigate to your unit test class or
+ method, then right-click it and select <strong>Run</strong> <img src=
+ "{@docRoot}images/tools/as-run.png" alt="" style=
+ "vertical-align:bottom;margin:0;">.
+ <ul>
+ <li>To run all tests in the unit test directory, right-click on the
+ directory and select <strong>Run tests</strong> <img src=
+ "{@docRoot}images/tools/as-run.png" alt="" style=
+ "vertical-align:bottom;margin:0;">.
+ </li>
+ </ul>
+ </li>
</ol>
-<p>Android Studio displays the results of the instrumented test execution in the
-<strong>Run</strong> window.</p>
+<p>
+ The Android Plugin for Gradle compiles the local unit test code located in
+ the default directory ({@code src/test/java}), builds a test app, and
+ executes it locally using the default test runner class. Android Studio then
+ displays the results in the <em>Run</em> window.
+</p>
-<p>To run your instrumented tests from the command-line via Gradle, call the
- {@code connectedAndroidTest} (or {@code cAT}) task:</p>
+<h3 id="run-instrumented-tests">
+ Run Instrumented Tests
+</h3>
-<pre>
-./gradlew cAT
-</pre>
+<p>
+ To run your instrumented tests:
+</p>
-<p>You can find the generated HTML test result reports in the
-{@code <path_to_your_project>/app/build/outputs/reports/androidTests/connected/} directory,
-and the corresponding XML files in the
-{@code <path_to_your_project>/app/build/outputs/androidTest-results/connected/} directory.</p>
\ No newline at end of file
+<ol>
+ <li>Open the <em>Build Variants</em> window by clicking the left-hand tab,
+ then set the test artifact to <em>Android Instrumentation Tests</em>.
+ </li>
+
+ <li>In the <em>Project</em> window, navigate to your instrumented test class
+ or method, then right-click and run it using the Android Test configuration.
+ To run all tests in the instrumented test directory, right-click the
+ directory and select <strong>Run tests</strong> <img src=
+ "{@docRoot}images/tools/as-run.png" alt="" style=
+ "vertical-align:bottom;margin:0;">.
+ </li>
+</ol>
+
+<p>
+ The <a href="{@docRoot}tools/building/plugin-for-gradle.html">Android Plugin
+ for Gradle</a> compiles the instrumented test code located in the default
+ directory ({@code src/androidTest/java}), builds a test APK and production
+ APK, installs both APKs on the connected device or emulator, and runs the
+ tests. Android Studio then displays the results of the instrumented test execution in the
+ <em>Run</em> window.
+</p>
+
+<h3 id="run-ctl">Run Instrumented Tests with Cloud Test Lab</h3>
+
+<p>
+ Using <a href="https://developers.google.com/cloud-test-lab/">Cloud Test
+ Lab</a>, you can simultaneously test your app on many popular Android
+ devices, across multiple languages, screen orientations, and versions of the
+ Android platform. These tests run on actual physical devices in remote Google
+ data centers. You can also <a href=
+ "https://developers.google.com/cloud-test-lab/test-screenshots">configure
+ your instrumented tests to take screenshots</a> while Cloud Test Lab runs its
+ tests. You can <a href=
+ "https://developers.google.com/cloud-test-lab/command-line">deploy tests to
+ Cloud Test Lab from the command line</a>, or from Android Studio's integrated
+ testing tools.
+</p>
+
+<p>
+ Android Studio allows you to connect to your Google Cloud Platform account,
+ configure your tests, deploy them to Cloud Test Lab, and analyze the results
+ all within the development environment. Cloud Test Lab in Android Studio
+ supports the following Android test frameworks: <a href=
+ "{@docRoot}training/testing/ui-testing/espresso-testing.html">Espresso</a>,
+ <a href="{@docRoot}tools/testing-support-library/index.html#UIAutomator">UI
+ Automator 2.0</a>, or <a class="external-link" href=
+ "https://github.com/robotiumtech/robotium">Robotium</a>. Test results provide
+ test logs and include the details of any app failures.
+</p>
+
+<p>
+ Before you can start using Cloud Test Lab, you need to:
+</p>
+
+<ol>
+ <li>
+ <a href="https://console.developers.google.com/freetrial">Create a
+ Google Cloud Platform account</a> to use with active billing.
+ </li>
+
+ <li>
+ <a href="https://support.google.com/cloud/answer/6251787">Create a Google
+ Cloud project</a> for your app.
+ </li>
+
+ <li>
+ <a href="https://support.google.com/cloud/answer/6288653">Set up an active
+ billing account</a> and associate it with the project you just created.
+ </li>
+</ol>
+
+<h4 id="configure-matrix">
+Configure a test matrix and run a test
+</h4>
+
+<p>
+ Android Studio provides integrated tools that allow you to configure how you
+ want to deploy your tests to Cloud Test Lab. After you have created a Google
+ Cloud project with active billing, you can create a test configuration and
+ run your tests:
+</p>
+
+<ol>
+ <li>Click <strong>Run</strong> > <strong>Edit Configurations</strong> from
+ the main menu.
+ </li>
+
+ <li>Click <strong>Add New Configuration (+)</strong> and select
+ <strong>Android Tests</strong>.
+ </li>
+
+ <li>In the Android Test configuration dialog:
+ <ol type="a">
+ <li>Enter or select the details of your test, such as the test name, module
+ type, test type, and test class.
+ </li>
+
+ <li>From the <em>Target</em> drop-down menu under <em>Deployment Target
+ Options</em>, select <strong>Cloud Test Lab Device Matrix</strong>.
+ </li>
+
+ <li>If you are not logged in, click <strong>Connect to Google Cloud
+ Platform</strong> and allow Android Studio access to your account.
+ </li>
+
+ <li>Next to <em>Cloud Project</em>, click the <img src=
+ "{@docRoot}images/tools/as-wrench.png" alt="wrench and nut" style=
+ "vertical-align:bottom;margin:0;"> button and select your Google Cloud
+ Platform project from the list.
+ </li>
+ </ol>
+ </li>
+
+ <li>Create and configure a test matrix:
+ <ol type="a">
+ <li>Next to the <em>Matrix Configuration</em> drop-down list, click <strong>
+ Open Dialog</strong> <img src="{@docRoot}images/tools/as-launchavdm.png"
+ alt="ellipses button" style="vertical-align:bottom;margin:0;">.
+ </li>
+
+ <li>Click <strong>Add New Configuration (+)</strong>.
+ </li>
+
+ <li>In the <strong>Name</strong> field, enter a name for your new
+ configuration.
+ </li>
+
+ <li>Select the device(s), Android version(s), locale(s) and screen
+ orientation(s) that you want to test your app with. Cloud Test Lab will test
+ your app against every combination of your selections when generating test
+ results.
+ </li>
+
+ <li>Click <strong>OK</strong> to save your configuration.
+ </li>
+ </ol>
+ </li>
+
+ <li>Click <strong>OK</strong> in the <em>Run/Debug Configurations</em> dialog
+ to exit.
+ </li>
+
+ <li>Run your tests by clicking <strong>Run</strong> <img src=
+ "{@docRoot}images/tools/as-run.png" alt="" style=
+ "vertical-align:bottom;margin:0;">.
+ </li>
+</ol>
+
+<h4 id="ctl-results">
+ Analyzing test results
+</h4>
+
+<p>
+ When Cloud Test Lab completes running your tests, the <em>Run</em> window will
+ open to show the results, as shown in figure 1. You may need to click
+ <strong>Show Passed</strong> <img src="{@docRoot}images/tools/as-ok.png" alt=
+ "" style="vertical-align:bottom;margin:0;"> to see all your executed tests.
+</p>
+
+<p>
+ <img src="{@docRoot}images/training/ctl-test-results.png" alt="">
+</p>
+
+<p class="img-caption">
+ <strong>Figure 1.</strong> Viewing the results of instrumented tests using
+ Cloud Test Lab.
+</p>
+
+<p>
+ You can also analyze your tests on the web by following the link displayed at
+ the beginning of the test execution log in the <em>Run</em> window, as shown
+ in figure 2.
+</p>
+
+<p>
+ <img src="{@docRoot}images/training/ctl-exec-log.png" alt="">
+</p>
+
+<p class="img-caption">
+ <strong>Figure 2.</strong> Click the link to view detailed test results on
+ the web.
+</p>
+
+<p>
+ To learn more about interpreting web results, see <a href=
+ "https://developers.google.com/cloud-test-lab/analyzing-results">Analyzing
+ Cloud Test Lab Web Results</a>.
+</p>
\ No newline at end of file