blob: 7a2a6660c013e7158649bd2bf51dcc3d7f2e0677 [file] [log] [blame]
Dirk Doughertybd58d6f2015-08-17 06:50:29 -07001page.title=Set Up the SDK
Dirk Dougherty74709452015-05-15 00:51:24 -07002page.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>
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070012 <li><a href="#get-sdk">Get the Android 6.0 SDK</a></li>
Joe Fernandez23fcc392015-05-19 12:27:07 -070013 <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
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070019<p>With Developer Preview 3, the <strong>official Android 6.0 SDK is now available</strong> from the Android SDK
Joe Fernandezbd4ed322015-08-16 16:56:02 -070020Manager. 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>
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070029 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
Joe Fernandezbd4ed322015-08-16 16:56:02 -070031 higher, or follow the instructions for
32 <a href="{@docRoot}sdk/installing/index.html?pkg=studio">Installing Android Studio</a>.
33</p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070034
Joe Fernandez306f1ce2015-05-01 12:51:21 -070035
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070036<h2 id="get-sdk">Get the Android 6.0 SDK</h2>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070037
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070038<p>To add the Android 6.0 SDK components to your development environment:</p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070039
40<ol>
Joe Fernandezbd4ed322015-08-16 16:56:02 -070041 <li>Launch Android Studio 1.3 or higher.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070042 </li>
43
Andrew Solovay525a0852015-05-28 10:56:57 -070044 <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
Joe Fernandezbd4ed322015-08-16 16:56:02 -070049 <p class="aside">On Mac OS X, you can find the <strong>Appearance &amp;
Andrew Solovay525a0852015-05-28 10:56:57 -070050 Behavior</strong> panel
51 in Android Studio's <strong>Preferences</strong> window.</p>
52 </li>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070053
Joe Fernandezbd4ed322015-08-16 16:56:02 -070054 <li>On the <strong>Updates</strong> panel, choose the option for
Andrew Solovay7d36a252015-05-28 18:33:29 -070055 <strong>Automatically check updates for Android SDK: Preview Channel</strong>.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070056 </li>
57
Andrew Solovay525a0852015-05-28 10:56:57 -070058 <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.)
Andrew Solovaya024a6d2015-05-27 11:07:35 -070061 </li>
62
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070063 <li>Under the <strong>Platforms</strong> section, select <strong>Android 6.0</strong>.
Andrew Solovaya024a6d2015-05-27 11:07:35 -070064 </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
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070075 <li>Verify that the Android 6.0 SDK is installed by opening the <strong>
Andrew Solovaya024a6d2015-05-27 11:07:35 -070076 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
Dirk Doughertybd58d6f2015-08-17 06:50:29 -070080 the <strong>SDK Platforms</strong> tab. <strong>Android 6.0</strong> should be listed as <em>Installed</em>. Also, open the
Andrew Solovaya024a6d2015-05-27 11:07:35 -070081 <strong>SDK Tools</strong> tab to verify that the latest tools are
82 installed.
83 </li>
84</ol>
Joe Fernandez23fcc392015-05-19 12:27:07 -070085<p>After completing these steps, the preview components are available in your development
86 environment. </p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070087
Joe Fernandez306f1ce2015-05-01 12:51:21 -070088
Joe Fernandez23fcc392015-05-19 12:27:07 -070089<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>
David Friedman35196642015-05-27 23:09:20 -0700100 We recommend using Android Studio to create a project with the preview. Follow the steps
Joe Fernandez23fcc392015-05-19 12:27:07 -0700101 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.
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700104</p>
105
106<ul>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700107 <li>Check <strong>Phone and Tablet</strong>.</li>
Joe Fernandezbd4ed322015-08-16 16:56:02 -0700108 <li>Select <strong>API 23: Android 6.0 (Marshmallow)</strong> in <strong>Minimum
Andrew Solovay525a0852015-05-28 10:56:57 -0700109 SDK</strong>.</li>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700110</ul>
111
Joe Fernandez23fcc392015-05-19 12:27:07 -0700112
113<h3 id="update">Update an existing project</h3>
114
115<p>
Dirk Doughertybd58d6f2015-08-17 06:50:29 -0700116 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
Joe Fernandez23fcc392015-05-19 12:27:07 -0700119 set these values as follows:
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700120</p>
121
Joe Fernandez23fcc392015-05-19 12:27:07 -0700122<ul>
Joe Fernandezbd4ed322015-08-16 16:56:02 -0700123 <li><code>compileSdkVersion</code> is set to <code>'23'</code></li>
124 <li><code>targetSdkVersion</code> is set to <code>'23'</code></li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700125</ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700126
127
Joe Fernandez23fcc392015-05-19 12:27:07 -0700128<h2 id="setup-test">Set Up for Testing</h2>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700129
Joe Fernandez23fcc392015-05-19 12:27:07 -0700130<p>
David Friedmana728e502015-05-27 23:30:50 -0700131 Testing an app with the preview requires that you have a device or virtual device configured with
Joe Fernandez23fcc392015-05-19 12:27:07 -0700132 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.
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700134</p>
135
Andrew Solovay525a0852015-05-28 10:56:57 -0700136<h3 id="setup-device">Set up a physical device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700137
Joe Fernandez23fcc392015-05-19 12:27:07 -0700138<p>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700139 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 -0700140 system image on these devices for testing your app.
David Friedmana728e502015-05-27 23:30:50 -0700141 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 -0700142 using the Android Virtual Device Manager tool.
143</p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700144
Joe Fernandez23fcc392015-05-19 12:27:07 -0700145<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>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700149
Andrew Solovay525a0852015-05-28 10:56:57 -0700150<h3 id="setupAVD">Set up a virtual device</h3>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700151
Joe Fernandez23fcc392015-05-19 12:27:07 -0700152<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>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700156
157<p>To create an AVD with the AVD Manager:</p>
158
159<ol>
Andrew Solovaya024a6d2015-05-27 11:07:35 -0700160 <li>Install the Preview SDK in your development environment, as described
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700161 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>
Andrew Solovay525a0852015-05-28 10:56:57 -0700167 <li><strong>Device:</strong> Nexus 5, Nexus 6, Nexus 9, or Android TV</li>
Joe Fernandez23fcc392015-05-19 12:27:07 -0700168 <li><strong>Target:</strong>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700169 Android M (Preview) - API Level M</li>
Andrew Solovay525a0852015-05-28 10:56:57 -0700170 <li><strong>ABI:</strong> x86</li>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700171 </ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700172 </li>
173</ol>
174
Joe Fernandez23fcc392015-05-19 12:27:07 -0700175<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>