blob: 7f0c7d54ed56841b43ebb59a931b2f1f53a1c4c1 [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 Solovaya024a6d2015-05-27 11:07:35 -070027<p>The Developer Preview requires Android Studio 1.3, which is in
28preview status. You need
29to install the preview version of Android Studio 1.3 to work with the Preview
30SDK.</p>
31
32<p class="caution"><strong>Caution:</strong> The canary preview of Android
33Studio 1.3 is still in active development. If you are using your primary development
34machine to test the developer preview, you should create a second installation
35of Android Studio to use for testing.</p>
36
37<p>To install the Android Studio 1.3 preview:</p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070038
39<ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070040 <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 &gt;
45 Settings</strong>. Choose the <strong>Appearance &amp; Behavior &gt; System
46 Settings &gt; 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 Fernandez306f1ce2015-05-01 12:51:21 -070056</ol>
57
Andrew Solovaya024a6d2015-05-27 11:07:35 -070058<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 &gt;
67 Settings</strong>. Choose the <strong>Appearance &amp; Behavior &gt; System
68 Settings &gt; 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 &amp; Behavior
95 &gt; System Settings &gt; 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 Fernandez23fcc392015-05-19 12:27:07 -0700104<p>After completing these steps, the preview components are available in your development
105 environment. </p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700106
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700107
Joe Fernandez23fcc392015-05-19 12:27:07 -0700108<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 Friedman35196642015-05-27 23:09:20 -0700119 We recommend using Android Studio to create a project with the preview. Follow the steps
Joe Fernandez23fcc392015-05-19 12:27:07 -0700120 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 Fernandez306f1ce2015-05-01 12:51:21 -0700123</p>
124
125<ul>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700126 <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 Fernandez306f1ce2015-05-01 12:51:21 -0700128</ul>
129
Joe Fernandez23fcc392015-05-19 12:27:07 -0700130
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 Fernandez306f1ce2015-05-01 12:51:21 -0700137</p>
138
Joe Fernandez23fcc392015-05-19 12:27:07 -0700139<ul>
140 <li><code>compileSdkVersion</code> is set to <code>'android-MNC'</code></li>
Joe Fernandez3f9669b2015-05-26 12:45:39 -0700141 <li><code>minSdkVersion</code> is set to <code>'MNC'</code></li>
142 <li><code>targetSdkVersion</code> is set to <code>'MNC'</code></li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700143</ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700144
145
Joe Fernandez23fcc392015-05-19 12:27:07 -0700146<h2 id="setup-test">Set Up for Testing</h2>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700147
Joe Fernandez23fcc392015-05-19 12:27:07 -0700148<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 Fernandez306f1ce2015-05-01 12:51:21 -0700152</p>
153
Joe Fernandez23fcc392015-05-19 12:27:07 -0700154<h3 id="setup-device">Set up a Physical Device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700155
Joe Fernandez23fcc392015-05-19 12:27:07 -0700156<p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700157 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 -0700158 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 Fernandez306f1ce2015-05-01 12:51:21 -0700162
Joe Fernandez23fcc392015-05-19 12:27:07 -0700163<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 Fernandez306f1ce2015-05-01 12:51:21 -0700167
Joe Fernandez23fcc392015-05-19 12:27:07 -0700168<h3 id="setupAVD">Set up a Virtual Device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700169
Joe Fernandez23fcc392015-05-19 12:27:07 -0700170<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 Fernandez306f1ce2015-05-01 12:51:21 -0700174
175<p>To create an AVD with the AVD Manager:</p>
176
177<ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700178 <li>Install the Preview SDK in your development environment, as described
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700179 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 Fernandez23fcc392015-05-19 12:27:07 -0700185 <li><strong>Device:</strong> Nexus 5, Nexus 6, Nexus 9, or Nexus Player</li>
186 <li><strong>Target:</strong>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700187 Android M (Preview) - API Level M</li>
188 </ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700189 </li>
190</ol>
191
Joe Fernandez23fcc392015-05-19 12:27:07 -0700192<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>