summaryrefslogtreecommitdiffstats
path: root/docs/html/preview/setup-sdk.jd
blob: 16160538c1bb716558920855a1d9cda70b8202a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
page.title=Set Up the Preview SDK
page.image=images/cards/card-set-up_16-9_2x.png

@jd:body


<div id="qv-wrapper">
  <div id="qv">
    <h2>In this document</h2>
      <ol>
        <li><a href="#get-as13">Get Android Studio 1.3</a></li>
        <li><a href="#get-sdk">Get the Preview SDK</a></li>
        <li><a href="#create-update">Create or Update a Project</a></li>
        <li><a href="#setup-test">Set Up for Testing</a></li>
      </ol>
  </div>
</div>

<p>The M Developer Preview SDK is available from the Android SDK Manager.
This document assumes that you are familiar with Android app development, such
as using the Android SDK Manager and creating projects. If you are new to
Android, see <a href="{@docRoot}training/basics/firstapp/index.html">Building Your First
App</a> training lesson first.</a></p>

<h2 id="get-as13">Get Android Studio 1.3</h2>

<p>The Developer Preview requires Android Studio 1.3, which is in
preview status. You need
to install the preview version of Android Studio 1.3 to work with the Preview
SDK.</p>

<p class="caution"><strong>Caution:</strong> The canary preview of Android
Studio 1.3 is still in active development. If you are using your primary development
machine to test the developer preview, you should create a second installation
of Android Studio to use for testing.</p>

<p>To install the Android Studio 1.3 preview:</p>

<ol>
  <li>Download and launch <a href="{@docRoot}tools/studio/index.html">Android
  Studio</a>.
  </li>

  <li>Open the <strong>Settings</strong> window by choosing <strong>File &gt;
  Settings</strong>. Choose the <strong>Appearance &amp; Behavior &gt; System
  Settings &gt; Updates</strong> panel.</li>

  <li> On the <strong>Updates</strong> panel, choose the option
  <strong>Automatically check updates for: Canary Chanel</strong>.
  </li>

  <li>On the <strong>Updates</strong> panel, select <strong>Check Now</strong>
  to check for the latest canary build. Download and install the build when you
  are prompted.
  </li>
</ol>

<h2 id="get-sdk">Get the Preview SDK</h2>

<p>To add the Preview SDK components to your development environment:</p>

<ol>
  <li>Launch the Android Studio 1.3 preview.
  </li>

  <li>Open the <strong>Settings</strong> window by choosing <strong>File &gt;
  Settings</strong>. Choose the <strong>Appearance &amp; Behavior &gt; System
  Settings &gt; Updates</strong> panel.</li>

  <li>On the <strong>Updates</strong> panel, choose the options
  <strong>Automatically check updates for: Canary Chanel</strong> and
  <strong>Automatically check updates for Android SDK: Preview Chanel</strong>.
  </li>

  <li>Click the <strong>Android SDK Manager</strong> button to launch the SDK
  Manager. (With Android Studio 1.3, the SDK Manager is integrated into Android
  Studio instead of being a standalone application.)
  </li>

  <li>Under the <strong>Platforms</strong> section, select <strong>Android MNC
  Preview</strong>.
  </li>

  <li>In the <strong>Tools</strong> section, select the latest Android <strong>
    SDK Tools</strong>, <strong>Platform-tools</strong>, and
    <strong>Build-tools</strong>.
  </li>

  <li>Click <strong>Install packages</strong> and accept the licensing
    agreement for all of the packages.
  </li>

  <li>Verify that the M Developer Preview is installed by opening the <strong>
    Settings</strong> window and choosing the <strong>Appearance &amp; Behavior
    &gt; System Settings &gt; Android SDK</strong> panel.</li>

  <li>On the <strong>Android SDK</strong> panel, choose
    the <strong>SDK Platforms</strong> tab. <strong>Android MNC
    Preview</strong> should be listed as <em>Installed</em>. Also, open the
    <strong>SDK Tools</strong> tab to verify that the latest tools are
    installed.
  </li>
</ol>
<p>After completing these steps, the preview components are available in your development
  environment. </p>


<h2 id="create-update">Create or Update a Project</h2>

<p>
  In order to use the preview APIs, you must create or update a development project to use
  the preview components.
</p>


<h3 id="create">Create a new project</h3>

<p>
  We recommend using Android Studio to create a project with the preview. Follow the steps
  described in <a href="{@docRoot}sdk/installing/create-project.html">Creating a Project</a>
  until you arrive at the <em>Form Factors</em> screen in the project wizard. Then perform
  the following steps to create a project configured for the preview.
</p>

<ul>
  <li>Check <strong>Phone and Tablet</strong>.</li>
  <li>Select <strong>API 22+: Android M (Preview)</strong> in <strong>Minimum SDK</strong>.</li>
</ul>


<h3 id="update">Update an existing project</h3>

<p>
  For existing projects, you must modify the project configuration to enable the preview APIs. In
  your development environment, open the <code>build.gradle</code> file for your module and
  set these values as follows:
</p>

<ul>
  <li><code>compileSdkVersion</code> is set to <code>'android-MNC'</code></li>
  <li><code>minSdkVersion</code> is set to <code>'MNC'</code></li>
  <li><code>targetSdkVersion</code> is set to <code>'MNC'</code></li>
</ul>


<h2 id="setup-test">Set Up for Testing</h2>

<p>
  Testing an app with the preview requires that you have a device or virtual device configured with
  the preview version of the platform. If you have a compatible device, you can install the preview
  platform for testing. Otherwise, you can configure a virtual device for testing.
</p>

<h3 id="setup-device">Set up a Physical Device</h3>

<p>
  If you have a Nexus 5, Nexus 6, Nexus 9, or Android TV, you can install a preview
  system image on these devices for testing your app.
  You can set up a virtual device with the preview version of the platform from within Android Studio
  using the Android Virtual Device Manager tool.
</p>

<p class="caution">
  <strong>Important:</strong> Installing a preview image on a device <em>removes all data from
  it</em>, so you should backup any data before installing a preview image.
</p>

<h3 id="setupAVD">Set up a Virtual Device</h3>

<p>
  You can set up virtual device with the preview version of the platform from within Android Studio
  using the Android Virtual Device Manager tool.
</p>

<p>To create an AVD with the AVD Manager:</p>

<ol>
  <li>Install the Preview SDK in your development environment, as described
      in <a href="{@docRoot}preview/setup-sdk.html">Setting Up the Preview
      SDK.</a></li>
  <li>Follow the steps in
      <a href="{@docRoot}tools/devices/managing-avds.html">Managing AVDs with AVD
      Manager</a>. Use the following settings:
    <ul>
      <li><strong>Device:</strong> Nexus 5, Nexus 6, Nexus 9, or Nexus Player</li>
      <li><strong>Target:</strong>
       Android M (Preview) - API Level M</li>
    </ul>
  </li>
</ol>

<p>
  For more information about creating virtual devices for testing, see <a href=
  "{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>.
</p>