blob: d3327e8dbbe1e8943281ba8a53b817a8d85a0605 [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
Andrew Solovaya024a6d2015-05-27 11:07:35 -070019<p>The M Developer Preview SDK is available from the Android SDK Manager.
Joe Fernandez306f1ce2015-05-01 12:51:21 -070020This 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
23App</a> training lesson first.</a></p>
24
Andrew Solovaya024a6d2015-05-27 11:07:35 -070025<h2 id="get-as13">Get Android Studio 1.3</h2>
Joe Fernandez23fcc392015-05-19 12:27:07 -070026
Andrew Solovay525a0852015-05-28 10:56:57 -070027<p>The Developer Preview is best used with Android Studio 1.3, which is in
28preview status. It is highly recommended that you install the preview version of
29Android Studio 1.3 to work with the Preview SDK.</p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070030
31<p class="caution"><strong>Caution:</strong> The canary preview of Android
32Studio 1.3 is still in active development. If you are using your primary development
Andrew Solovay525a0852015-05-28 10:56:57 -070033machine to test the developer preview, you can create a second installation
Andrew Solovaya024a6d2015-05-27 11:07:35 -070034of Android Studio to use for testing.</p>
35
36<p>To install the Android Studio 1.3 preview:</p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070037
38<ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070039 <li>Download and launch <a href="{@docRoot}tools/studio/index.html">Android
40 Studio</a>.
41 </li>
42
Andrew Solovay525a0852015-05-28 10:56:57 -070043 <li>Open the <strong>Settings</strong> window (on Windows, you can do this
44 by choosing <strong>File &gt; Settings</strong>). Choose the
45 <strong>Appearance &amp; Behavior &gt; System
46 Settings &gt; Updates</strong> panel.
47
48 <p class="aside">On OSX, you can find the <strong>Appearance &amp;
49 Behavior</strong> panel
50 in Android Studio's <strong>Preferences</strong> window.</p>
51 </li>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070052
53 <li> On the <strong>Updates</strong> panel, choose the option
Andrew Solovay7d36a252015-05-28 18:33:29 -070054 <strong>Automatically check updates for: Canary Channel</strong>.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070055 </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 Fernandez306f1ce2015-05-01 12:51:21 -070061</ol>
62
Andrew Solovaya024a6d2015-05-27 11:07:35 -070063<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 Solovay525a0852015-05-28 10:56:57 -070071 <li>Open the <strong>Settings</strong> window (on Windows, you can do this
72 by choosing <strong>File &gt; Settings</strong>). Choose the
73 <strong>Appearance &amp; Behavior &gt; System
74 Settings &gt; Updates</strong> panel.
75
76 <p class="aside">On OSX, you can find the <strong>Appearance &amp;
77 Behavior</strong> panel
78 in Android Studio's <strong>Preferences</strong> window.</p>
79 </li>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070080
81 <li>On the <strong>Updates</strong> panel, choose the options
Andrew Solovay7d36a252015-05-28 18:33:29 -070082 <strong>Automatically check updates for: Canary Channel</strong> and
83 <strong>Automatically check updates for Android SDK: Preview Channel</strong>.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070084 </li>
85
Andrew Solovay525a0852015-05-28 10:56:57 -070086 <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 Solovaya024a6d2015-05-27 11:07:35 -070089 </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 &amp; Behavior
106 &gt; System Settings &gt; 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 Fernandez23fcc392015-05-19 12:27:07 -0700115<p>After completing these steps, the preview components are available in your development
116 environment. </p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700117
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700118
Joe Fernandez23fcc392015-05-19 12:27:07 -0700119<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 Friedman35196642015-05-27 23:09:20 -0700130 We recommend using Android Studio to create a project with the preview. Follow the steps
Joe Fernandez23fcc392015-05-19 12:27:07 -0700131 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 Fernandez306f1ce2015-05-01 12:51:21 -0700134</p>
135
136<ul>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700137 <li>Check <strong>Phone and Tablet</strong>.</li>
Andrew Solovay525a0852015-05-28 10:56:57 -0700138 <li>Select <strong>MNC: Android M (Preview)</strong> in <strong>Minimum
139 SDK</strong>.</li>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700140</ul>
141
Joe Fernandez23fcc392015-05-19 12:27:07 -0700142
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 Friedmana728e502015-05-27 23:30:50 -0700147 your development environment, open the <code>build.gradle</code> file for your module and
Joe Fernandez23fcc392015-05-19 12:27:07 -0700148 set these values as follows:
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700149</p>
150
Joe Fernandez23fcc392015-05-19 12:27:07 -0700151<ul>
152 <li><code>compileSdkVersion</code> is set to <code>'android-MNC'</code></li>
Joe Fernandez3f9669b2015-05-26 12:45:39 -0700153 <li><code>minSdkVersion</code> is set to <code>'MNC'</code></li>
154 <li><code>targetSdkVersion</code> is set to <code>'MNC'</code></li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700155</ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700156
157
Joe Fernandez23fcc392015-05-19 12:27:07 -0700158<h2 id="setup-test">Set Up for Testing</h2>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700159
Joe Fernandez23fcc392015-05-19 12:27:07 -0700160<p>
David Friedmana728e502015-05-27 23:30:50 -0700161 Testing an app with the preview requires that you have a device or virtual device configured with
Joe Fernandez23fcc392015-05-19 12:27:07 -0700162 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 Fernandez306f1ce2015-05-01 12:51:21 -0700164</p>
165
Andrew Solovay525a0852015-05-28 10:56:57 -0700166<h3 id="setup-device">Set up a physical device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700167
Joe Fernandez23fcc392015-05-19 12:27:07 -0700168<p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700169 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 -0700170 system image on these devices for testing your app.
David Friedmana728e502015-05-27 23:30:50 -0700171 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 -0700172 using the Android Virtual Device Manager tool.
173</p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700174
Joe Fernandez23fcc392015-05-19 12:27:07 -0700175<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 Fernandez306f1ce2015-05-01 12:51:21 -0700179
Andrew Solovay525a0852015-05-28 10:56:57 -0700180<h3 id="setupAVD">Set up a virtual device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700181
Joe Fernandez23fcc392015-05-19 12:27:07 -0700182<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 Fernandez306f1ce2015-05-01 12:51:21 -0700186
187<p>To create an AVD with the AVD Manager:</p>
188
189<ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700190 <li>Install the Preview SDK in your development environment, as described
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700191 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 Solovay525a0852015-05-28 10:56:57 -0700197 <li><strong>Device:</strong> Nexus 5, Nexus 6, Nexus 9, or Android TV</li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700198 <li><strong>Target:</strong>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700199 Android M (Preview) - API Level M</li>
Andrew Solovay525a0852015-05-28 10:56:57 -0700200 <li><strong>ABI:</strong> x86</li>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700201 </ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700202 </li>
203</ol>
204
Joe Fernandez23fcc392015-05-19 12:27:07 -0700205<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>