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