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