blob: a4d9418d7c159923670aaeba5976c59c213c4683 [file] [log] [blame]
Dirk Dougherty74709452015-05-15 00:51:24 -07001page.title=Set Up the Preview SDK
2page.image=images/cards/card-set-up_16-9_2x.png
Joe Fernandez23fcc392015-05-19 12:27:07 -07003
Joe Fernandez306f1ce2015-05-01 12:51:21 -07004@jd:body
5
6
Joe Fernandez23fcc392015-05-19 12:27:07 -07007<div id="qv-wrapper">
8 <div id="qv">
9 <h2>In this document</h2>
10 <ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070011 <li><a href="#get-as13">Get Android Studio 1.3</a></li>
Joe Fernandez23fcc392015-05-19 12:27:07 -070012 <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 Fernandez306f1ce2015-05-01 12:51:21 -070018
Joe Fernandezbd4ed322015-08-16 16:56:02 -070019<p>With Developer Preview 3, the official Android 6.0 SDK is now available from the Android SDK
20Manager. This document assumes that you are familiar with Android app development, such
Joe Fernandez23fcc392015-05-19 12:27:07 -070021as using the Android SDK Manager and creating projects. If you are new to
Joe Fernandez306f1ce2015-05-01 12:51:21 -070022Android, see <a href="{@docRoot}training/basics/firstapp/index.html">Building Your First
Joe Fernandezbd4ed322015-08-16 16:56:02 -070023App</a> training lesson first.</p>
24
Joe Fernandez306f1ce2015-05-01 12:51:21 -070025
Andrew Solovaya024a6d2015-05-27 11:07:35 -070026<h2 id="get-as13">Get Android Studio 1.3</h2>
Joe Fernandez23fcc392015-05-19 12:27:07 -070027
Joe Fernandezbd4ed322015-08-16 16:56:02 -070028<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 Solovaya024a6d2015-05-27 11:07:35 -070035
Joe Fernandez306f1ce2015-05-01 12:51:21 -070036
Andrew Solovaya024a6d2015-05-27 11:07:35 -070037<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 Fernandezbd4ed322015-08-16 16:56:02 -070042 <li>Launch Android Studio 1.3 or higher.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070043 </li>
44
Andrew Solovay525a0852015-05-28 10:56:57 -070045 <li>Open the <strong>Settings</strong> window (on Windows, you can do this
46 by choosing <strong>File &gt; Settings</strong>). Choose the
47 <strong>Appearance &amp; Behavior &gt; System
48 Settings &gt; Updates</strong> panel.
49
Joe Fernandezbd4ed322015-08-16 16:56:02 -070050 <p class="aside">On Mac OS X, you can find the <strong>Appearance &amp;
Andrew Solovay525a0852015-05-28 10:56:57 -070051 Behavior</strong> panel
52 in Android Studio's <strong>Preferences</strong> window.</p>
53 </li>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070054
Joe Fernandezbd4ed322015-08-16 16:56:02 -070055 <li>On the <strong>Updates</strong> panel, choose the option for
Andrew Solovay7d36a252015-05-28 18:33:29 -070056 <strong>Automatically check updates for Android SDK: Preview Channel</strong>.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070057 </li>
58
Andrew Solovay525a0852015-05-28 10:56:57 -070059 <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 Solovaya024a6d2015-05-27 11:07:35 -070062 </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 &amp; Behavior
79 &gt; System Settings &gt; 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 Fernandez23fcc392015-05-19 12:27:07 -070088<p>After completing these steps, the preview components are available in your development
89 environment. </p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070090
Joe Fernandez306f1ce2015-05-01 12:51:21 -070091
Joe Fernandez23fcc392015-05-19 12:27:07 -070092<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 Friedman35196642015-05-27 23:09:20 -0700103 We recommend using Android Studio to create a project with the preview. Follow the steps
Joe Fernandez23fcc392015-05-19 12:27:07 -0700104 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 Fernandez306f1ce2015-05-01 12:51:21 -0700107</p>
108
109<ul>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700110 <li>Check <strong>Phone and Tablet</strong>.</li>
Joe Fernandezbd4ed322015-08-16 16:56:02 -0700111 <li>Select <strong>API 23: Android 6.0 (Marshmallow)</strong> in <strong>Minimum
Andrew Solovay525a0852015-05-28 10:56:57 -0700112 SDK</strong>.</li>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700113</ul>
114
Joe Fernandez23fcc392015-05-19 12:27:07 -0700115
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 Friedmana728e502015-05-27 23:30:50 -0700120 your development environment, open the <code>build.gradle</code> file for your module and
Joe Fernandez23fcc392015-05-19 12:27:07 -0700121 set these values as follows:
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700122</p>
123
Joe Fernandez23fcc392015-05-19 12:27:07 -0700124<ul>
Joe Fernandezbd4ed322015-08-16 16:56:02 -0700125 <li><code>compileSdkVersion</code> is set to <code>'23'</code></li>
126 <li><code>targetSdkVersion</code> is set to <code>'23'</code></li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700127</ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700128
129
Joe Fernandez23fcc392015-05-19 12:27:07 -0700130<h2 id="setup-test">Set Up for Testing</h2>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700131
Joe Fernandez23fcc392015-05-19 12:27:07 -0700132<p>
David Friedmana728e502015-05-27 23:30:50 -0700133 Testing an app with the preview requires that you have a device or virtual device configured with
Joe Fernandez23fcc392015-05-19 12:27:07 -0700134 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 Fernandez306f1ce2015-05-01 12:51:21 -0700136</p>
137
Andrew Solovay525a0852015-05-28 10:56:57 -0700138<h3 id="setup-device">Set up a physical device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700139
Joe Fernandez23fcc392015-05-19 12:27:07 -0700140<p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700141 If you have a Nexus 5, Nexus 6, Nexus 9, or Android TV, you can install a preview
Joe Fernandez23fcc392015-05-19 12:27:07 -0700142 system image on these devices for testing your app.
David Friedmana728e502015-05-27 23:30:50 -0700143 You can set up a virtual device with the preview version of the platform from within Android Studio
Joe Fernandez23fcc392015-05-19 12:27:07 -0700144 using the Android Virtual Device Manager tool.
145</p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700146
Joe Fernandez23fcc392015-05-19 12:27:07 -0700147<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 Fernandez306f1ce2015-05-01 12:51:21 -0700151
Andrew Solovay525a0852015-05-28 10:56:57 -0700152<h3 id="setupAVD">Set up a virtual device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700153
Joe Fernandez23fcc392015-05-19 12:27:07 -0700154<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 Fernandez306f1ce2015-05-01 12:51:21 -0700158
159<p>To create an AVD with the AVD Manager:</p>
160
161<ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700162 <li>Install the Preview SDK in your development environment, as described
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700163 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 Solovay525a0852015-05-28 10:56:57 -0700169 <li><strong>Device:</strong> Nexus 5, Nexus 6, Nexus 9, or Android TV</li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700170 <li><strong>Target:</strong>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700171 Android M (Preview) - API Level M</li>
Andrew Solovay525a0852015-05-28 10:56:57 -0700172 <li><strong>ABI:</strong> x86</li>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700173 </ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700174 </li>
175</ol>
176
Joe Fernandez23fcc392015-05-19 12:27:07 -0700177<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>