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