Dirk Dougherty | 7470945 | 2015-05-15 00:51:24 -0700 | [diff] [blame] | 1 | page.title=Set Up the Preview SDK |
| 2 | page.image=images/cards/card-set-up_16-9_2x.png |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 3 | |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 4 | @jd:body |
| 5 | |
| 6 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 7 | <div id="qv-wrapper"> |
| 8 | <div id="qv"> |
| 9 | <h2>In this document</h2> |
| 10 | <ol> |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 11 | <li><a href="#get-as13">Get Android Studio 1.3</a></li> |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 12 | <li><a href="#get-sdk">Get the Preview SDK</a></li> |
| 13 | <li><a href="#create-update">Create or Update a Project</a></li> |
| 14 | <li><a href="#setup-test">Set Up for Testing</a></li> |
| 15 | </ol> |
| 16 | </div> |
| 17 | </div> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 18 | |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 19 | <p>The M Developer Preview SDK is available from the Android SDK Manager. |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 20 | This document assumes that you are familiar with Android app development, such |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 21 | as using the Android SDK Manager and creating projects. If you are new to |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 22 | Android, see <a href="{@docRoot}training/basics/firstapp/index.html">Building Your First |
| 23 | App</a> training lesson first.</a></p> |
| 24 | |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 25 | <h2 id="get-as13">Get Android Studio 1.3</h2> |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 26 | |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 27 | <p>The Developer Preview requires Android Studio 1.3, which is in |
| 28 | preview status. You need |
| 29 | to install the preview version of Android Studio 1.3 to work with the Preview |
| 30 | SDK.</p> |
| 31 | |
| 32 | <p class="caution"><strong>Caution:</strong> The canary preview of Android |
| 33 | Studio 1.3 is still in active development. If you are using your primary development |
| 34 | machine to test the developer preview, you should create a second installation |
| 35 | of Android Studio to use for testing.</p> |
| 36 | |
| 37 | <p>To install the Android Studio 1.3 preview:</p> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 38 | |
| 39 | <ol> |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 40 | <li>Download and launch <a href="{@docRoot}tools/studio/index.html">Android |
| 41 | Studio</a>. |
| 42 | </li> |
| 43 | |
| 44 | <li>Open the <strong>Settings</strong> window by choosing <strong>File > |
| 45 | Settings</strong>. Choose the <strong>Appearance & Behavior > System |
| 46 | Settings > Updates</strong> panel.</li> |
| 47 | |
| 48 | <li> On the <strong>Updates</strong> panel, choose the option |
| 49 | <strong>Automatically check updates for: Canary Chanel</strong>. |
| 50 | </li> |
| 51 | |
| 52 | <li>On the <strong>Updates</strong> panel, select <strong>Check Now</strong> |
| 53 | to check for the latest canary build. Download and install the build when you |
| 54 | are prompted. |
| 55 | </li> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 56 | </ol> |
| 57 | |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 58 | <h2 id="get-sdk">Get the Preview SDK</h2> |
| 59 | |
| 60 | <p>To add the Preview SDK components to your development environment:</p> |
| 61 | |
| 62 | <ol> |
| 63 | <li>Launch the Android Studio 1.3 preview. |
| 64 | </li> |
| 65 | |
| 66 | <li>Open the <strong>Settings</strong> window by choosing <strong>File > |
| 67 | Settings</strong>. Choose the <strong>Appearance & Behavior > System |
| 68 | Settings > Updates</strong> panel.</li> |
| 69 | |
| 70 | <li>On the <strong>Updates</strong> panel, choose the options |
| 71 | <strong>Automatically check updates for: Canary Chanel</strong> and |
| 72 | <strong>Automatically check updates for Android SDK: Preview Chanel</strong>. |
| 73 | </li> |
| 74 | |
| 75 | <li>Click the <strong>Android SDK Manager</strong> button to launch the SDK |
| 76 | Manager. (With Android Studio 1.3, the SDK Manager is integrated into Android |
| 77 | Studio instead of being a standalone application.) |
| 78 | </li> |
| 79 | |
| 80 | <li>Under the <strong>Platforms</strong> section, select <strong>Android MNC |
| 81 | Preview</strong>. |
| 82 | </li> |
| 83 | |
| 84 | <li>In the <strong>Tools</strong> section, select the latest Android <strong> |
| 85 | SDK Tools</strong>, <strong>Platform-tools</strong>, and |
| 86 | <strong>Build-tools</strong>. |
| 87 | </li> |
| 88 | |
| 89 | <li>Click <strong>Install packages</strong> and accept the licensing |
| 90 | agreement for all of the packages. |
| 91 | </li> |
| 92 | |
| 93 | <li>Verify that the M Developer Preview is installed by opening the <strong> |
| 94 | Settings</strong> window and choosing the <strong>Appearance & Behavior |
| 95 | > System Settings > Android SDK</strong> panel.</li> |
| 96 | |
| 97 | <li>On the <strong>Android SDK</strong> panel, choose |
| 98 | the <strong>SDK Platforms</strong> tab. <strong>Android MNC |
| 99 | Preview</strong> should be listed as <em>Installed</em>. Also, open the |
| 100 | <strong>SDK Tools</strong> tab to verify that the latest tools are |
| 101 | installed. |
| 102 | </li> |
| 103 | </ol> |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 104 | <p>After completing these steps, the preview components are available in your development |
| 105 | environment. </p> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 106 | |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 107 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 108 | <h2 id="create-update">Create or Update a Project</h2> |
| 109 | |
| 110 | <p> |
| 111 | In order to use the preview APIs, you must create or update a development project to use |
| 112 | the preview components. |
| 113 | </p> |
| 114 | |
| 115 | |
| 116 | <h3 id="create">Create a new project</h3> |
| 117 | |
| 118 | <p> |
David Friedman | 3519664 | 2015-05-27 23:09:20 -0700 | [diff] [blame^] | 119 | We recommend using Android Studio to create a project with the preview. Follow the steps |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 120 | described in <a href="{@docRoot}sdk/installing/create-project.html">Creating a Project</a> |
| 121 | until you arrive at the <em>Form Factors</em> screen in the project wizard. Then perform |
| 122 | the following steps to create a project configured for the preview. |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 123 | </p> |
| 124 | |
| 125 | <ul> |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 126 | <li>Check <strong>Phone and Tablet</strong>.</li> |
| 127 | <li>Select <strong>API 22+: Android M (Preview)</strong> in <strong>Minimum SDK</strong>.</li> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 128 | </ul> |
| 129 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 130 | |
| 131 | <h3 id="update">Update an existing project</h3> |
| 132 | |
| 133 | <p> |
| 134 | For existing projects, you must modify the project configuration to enable the preview APIs. In |
| 135 | your the development environment, open the <code>build.gradle</code> file for your module and |
| 136 | set these values as follows: |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 137 | </p> |
| 138 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 139 | <ul> |
| 140 | <li><code>compileSdkVersion</code> is set to <code>'android-MNC'</code></li> |
Joe Fernandez | 3f9669b | 2015-05-26 12:45:39 -0700 | [diff] [blame] | 141 | <li><code>minSdkVersion</code> is set to <code>'MNC'</code></li> |
| 142 | <li><code>targetSdkVersion</code> is set to <code>'MNC'</code></li> |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 143 | </ul> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 144 | |
| 145 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 146 | <h2 id="setup-test">Set Up for Testing</h2> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 147 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 148 | <p> |
| 149 | Testing app with the preview requires that you have a device or virtual device configured with |
| 150 | the preview version of the platform. If you have a compatible device, you can install the preview |
| 151 | platform for testing. Otherwise, you can configure a virtual device for testing. |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 152 | </p> |
| 153 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 154 | <h3 id="setup-device">Set up a Physical Device</h3> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 155 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 156 | <p> |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 157 | If you have a Nexus 5, Nexus 6, Nexus 9, or Android TV, you can install a preview |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 158 | system image on these devices for testing your app. |
| 159 | You can set up virtual device with the preview version of the platform from within Android Studio |
| 160 | using the Android Virtual Device Manager tool. |
| 161 | </p> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 162 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 163 | <p class="caution"> |
| 164 | <strong>Important:</strong> Installing a preview image on a device <em>removes all data from |
| 165 | it</em>, so you should backup any data before installing a preview image. |
| 166 | </p> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 167 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 168 | <h3 id="setupAVD">Set up a Virtual Device</h3> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 169 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 170 | <p> |
| 171 | You can set up virtual device with the preview version of the platform from within Android Studio |
| 172 | using the Android Virtual Device Manager tool. |
| 173 | </p> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 174 | |
| 175 | <p>To create an AVD with the AVD Manager:</p> |
| 176 | |
| 177 | <ol> |
Andrew Solovay | a024a6d | 2015-05-27 11:07:35 -0700 | [diff] [blame] | 178 | <li>Install the Preview SDK in your development environment, as described |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 179 | in <a href="{@docRoot}preview/setup-sdk.html">Setting Up the Preview |
| 180 | SDK.</a></li> |
| 181 | <li>Follow the steps in |
| 182 | <a href="{@docRoot}tools/devices/managing-avds.html">Managing AVDs with AVD |
| 183 | Manager</a>. Use the following settings: |
| 184 | <ul> |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 185 | <li><strong>Device:</strong> Nexus 5, Nexus 6, Nexus 9, or Nexus Player</li> |
| 186 | <li><strong>Target:</strong> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 187 | Android M (Preview) - API Level M</li> |
| 188 | </ul> |
Joe Fernandez | 306f1ce | 2015-05-01 12:51:21 -0700 | [diff] [blame] | 189 | </li> |
| 190 | </ol> |
| 191 | |
Joe Fernandez | 23fcc39 | 2015-05-19 12:27:07 -0700 | [diff] [blame] | 192 | <p> |
| 193 | For more information about creating virtual devices for testing, see <a href= |
| 194 | "{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>. |
| 195 | </p> |