blob: 72ef016566e3ee71d483bd1ee0f9d5f631a83e3e [file] [log] [blame]
Dirk Doughertycf65e4842016-03-07 22:31:57 -08001page.title=Set Up the Preview
Dirk Dougherty43eb9512016-03-03 14:53:16 -08002meta.keywords="preview", "android"
3page.tags="preview", "developer preview"
4page.image=images/cards/card-n-sdk_2x.png
Dirk Dougherty5748bc42016-02-06 18:24:32 -08005
6@jd:body
7
8
9<div id="qv-wrapper">
10 <div id="qv">
smain@google.com0a03f312016-03-07 16:38:37 -080011<ol>
12 <li><a href="#get-as13">Get Android Studio 2.1</a></li>
Joe Fernandez98b0ec62016-03-08 22:32:51 -080013 <li><a href="#get-sdk">Get the Android N SDK</a>
14 <ol>
15 <li><a href="#docs-dl">Reference documentation</a>
16 </ol>
17 </li>
Mary Yanchar1986a6e2016-03-30 13:56:12 -070018 <li><a href="#java8">Get the Java 8 JDK</a></li>
smain@google.com0a03f312016-03-07 16:38:37 -080019 <li><a href="#create-update">Update or Create a Project</a></li>
20 <li><a href="#next">Next Steps</a></li>
21</ol>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080022 </div>
23</div>
24
smain@google.com67894042016-03-08 21:14:47 -080025<p>To develop apps for the Android N Preview, you need to make some updates
26to your developer environment, as described on this page.</p>
smain@google.com0a03f312016-03-07 16:38:37 -080027
smain@google.coma329ffd2016-03-09 00:00:37 -080028<p>To simply test your app's compatibility on the
smain@google.com67894042016-03-08 21:14:47 -080029Android N system image, follow the guide to <a
smain@google.com3254f8c2016-03-08 17:25:50 -080030href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</p>
smain@google.com0a03f312016-03-07 16:38:37 -080031
smain@google.com02573e02016-03-08 18:42:51 -080032<img src="{@docRoot}preview/images/n-preview-setup.png" width="700" alt="" />
33
34
smain@google.com0a03f312016-03-07 16:38:37 -080035<h2 id="get-as13">Get Android Studio 2.1 (preview)</h2>
36
smain@google.coma329ffd2016-03-09 00:00:37 -080037<p>The Android N platform adds support for <a
38href="{@docRoot}preview/j8-jack.html">Java 8 language features</a>,
39which require a new compiler called Jack. The latest version of Jack
40is currently supported only in Android Studio 2.1. So if you want to
41use Java 8 language features, you need to use Android Studio 2.1 to
42build your app. Otherwise, you don't need to use the Jack compiler, but you
43still need to update to JDK 8 to compile against the Android N platform,
44as described below.
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080045</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080046
smain@google.comc4bb9a32016-03-08 13:27:37 -080047<iframe width="400" height="225" src="//www.youtube.com/embed/SBbWGxXCMqQ?autohide=1&amp;showinfo=0" frameborder="0" allowfullscreen="" style="float: right; margin: 0 0 20px 20px;"></iframe>
48
smain@google.com0a03f312016-03-07 16:38:37 -080049<p>Android Studio 2.1 is currently available as a preview in the canary
smain@google.comc4bb9a32016-03-08 13:27:37 -080050release channel. If you already
smain@google.com0a03f312016-03-07 16:38:37 -080051have Android Studio and don't want to update to the canary channel, you can
52download Android Studio 2.1 as a separate installation and use it
smain@google.coma329ffd2016-03-09 00:00:37 -080053for development with Android N, leaving your primary Android Studio
54environment unaffected.</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080055
smain@google.com0a03f312016-03-07 16:38:37 -080056<p>To download Android Studio 2.1 as a separate installation, follow these
57steps (or if you want to receive Android Studio 2.1 as an update to your
58existing installation, skip to step 4):</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080059
60<ol>
smain@google.com0a03f312016-03-07 16:38:37 -080061 <li>Edit the name of your
62 existing Android Studio installation and append the version number. This way,
63 when you install the new version, it will not override the existing one.</li>
64 <li>Download the appropriate ZIP file for your operating system from the
65 <a href="http://tools.android.com/download/studio/canary/latest"
66 >canary channel download page</a>.
Dirk Dougherty5748bc42016-02-06 18:24:32 -080067 </li>
smain@google.com0a03f312016-03-07 16:38:37 -080068 <li>Unzip the package and move the Android Studio 2.1 contents to the
69 appropriate location for applications on your system, then launch it.</li>
70 <li>Open the Settings dialog
71 (<strong>File &gt; Settings</strong> on Windows/Linux, or
72 <strong>Android Studio &gt; Preferences</strong> on Mac). In the left
73 panel, select <strong>Appearance &amp; Behavior &gt; System Settings &gt;
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080074 Updates</strong>.
Dirk Dougherty5748bc42016-02-06 18:24:32 -080075 </li>
smain@google.com0a03f312016-03-07 16:38:37 -080076 <li>On the Updates panel, select the <strong>Automatically
77 check updates for</strong> check box and select
78 <strong>Canary Channel</strong> from the drop-down list.
Dirk Dougherty5748bc42016-02-06 18:24:32 -080079 </li>
80</ol>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080081
smain@google.com0a03f312016-03-07 16:38:37 -080082<p>Keep this settings window open for the next step.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080083
smain@google.com0a03f312016-03-07 16:38:37 -080084
85<h2 id="get-sdk">Get the N Preview SDK</h2>
86
smain@google.com67894042016-03-08 21:14:47 -080087<p>To start developing with Android N APIs, you need to install the
88Android N Preview SDK in Android Studio as follows:</p>
smain@google.com0a03f312016-03-07 16:38:37 -080089
90<ol>
smain@google.coma329ffd2016-03-09 00:00:37 -080091 <li>While still viewing the Updates panel (step 4 from above),
92 select the <strong>Automatically
smain@google.com0a03f312016-03-07 16:38:37 -080093 check updates for Android SDK</strong> check box and select
94 <strong>Preview Channel</strong> from the drop-down list.
95 </li>
96 <li>Click <strong>Check Now</strong>.</li>
97
98 <li>In the left panel, select <strong>Appearance &amp; Behavior &gt;
99 System Settings &gt; Android SDK</strong>.
100
101 <li>Click the <strong>SDK Platforms</strong> tab, then select the
102 <strong>Android N Preview</strong> check box.</li>
103
104 <li>Click the <strong>SDK Tools</strong> tab, then select the
105 <strong>Android SDK Build Tools</strong>, <strong>Android SDK
106 Platform-Tools</strong>, and <strong>Android SDK Tools</strong> check
107 boxes.
108 </li>
109
110 <li>Click <strong>OK</strong>, then accept the licensing
111 agreements for any packages that need to be installed.
112 </li>
113</ol>
114
Joe Fernandez98b0ec62016-03-08 22:32:51 -0800115<h3 id="docs-dl">Get the N Preview reference documentation</h3>
116
117<p>
118 Detailed information about the Android N APIs is available in the N Preview
119 reference documentation, which you can download from the following table.
120 This package contains an abridged, offline version of the Android developer
121 web site, and includes an updated API reference for the Android N APIs and an
122 API difference report.
123</p>
124
125<table>
smain@google.com0a03f312016-03-07 16:38:37 -0800126 <tr>
127 <th scope="col">Documentation</th>
128 <th scope="col">Checksums</th>
129 </tr>
130 <tr>
131 <td style="white-space: nowrap">
Joe Fernandez0076ded2016-03-09 09:44:25 -0800132 <a href="{@docRoot}shareables/preview/n-preview-1-docs.zip"
smain@google.com0a03f312016-03-07 16:38:37 -0800133 >n-preview-1-docs.zip</a></td>
134 <td width="100%">
Joe Fernandez55d19212016-03-08 21:49:52 -0800135 MD5: 4ab33ccbe698f46f125cc5b807cf9c2f<br>
136 SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
smain@google.com0a03f312016-03-07 16:38:37 -0800137 </td>
138 </tr>
139<table>
140
141
142
Mary Yanchar1986a6e2016-03-30 13:56:12 -0700143<h2 id="java8">Get the Java 8 JDK</h2>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800144
Mary Yanchar1986a6e2016-03-30 13:56:12 -0700145<p>To compile your app against the Android N platform and use some tools with
146Android Studio 2.1, you need to install the Java 8 Developer Kit (JDK 8). So, if
147you don't already have the latest version, download JDK 8 now.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800148
smain@google.coma329ffd2016-03-09 00:00:37 -0800149<p>Then set the JDK version in Android Studio as follows:</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800150
smain@google.com0a03f312016-03-07 16:38:37 -0800151<ol>
152 <li>Open an Android project in Android Studio, then open the
153 Project Structure dialog by selecting <strong>File &gt;
smain@google.coma329ffd2016-03-09 00:00:37 -0800154 Project Structure</strong>. (Alternatively, you can set the default
155 for all projects by selecting <strong>File &gt; Other Settings &gt;
156 Default Project Structure</strong>.)
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800157 </li>
158 <li>In the left panel of the dialog, click <strong>SDK Location</strong>.
159 </li>
160 <li>In the <strong>JDK Location</strong> field, enter the location of the
smain@google.coma329ffd2016-03-09 00:00:37 -0800161 Java 8 JDK (click the button on the right
162 to browse your files), then click <strong>OK</strong>.
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800163 </li>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800164</ol>
165
smain@google.coma329ffd2016-03-09 00:00:37 -0800166<img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700"
167 alt="" />
168
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800169
smain@google.com0a03f312016-03-07 16:38:37 -0800170<h2 id="create-update">Update or Create a Project</h2>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800171
172<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800173 To use the Android N APIs, your project must be configured appropriately.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800174</p>
175
smain@google.coma329ffd2016-03-09 00:00:37 -0800176<p>If you plan to use Java 8 language features, you should also read
177<a href="{@docRoot}preview/j8-jack.html">Java 8 Language Features</a>
178for information about the supported Java 8 features and
179how to configure your project with the Jack compiler.</p>
smain@google.com67894042016-03-08 21:14:47 -0800180
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800181
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800182<h3 id="update">Update an existing project</h3>
183
smain@google.com0a03f312016-03-07 16:38:37 -0800184<p>Open the
185 <code>build.gradle</code> file for your module and update the values as
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800186 follows:
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800187</p>
188
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800189<pre>
190android {
191 compileSdkVersion <strong>'android-N'</strong>
Andrew Solovaydfd4b8f2016-03-10 15:58:01 -0800192 buildToolsVersion <strong>'24.0.0-rc1'</strong>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800193 ...
194
195 defaultConfig {
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800196 minSdkVersion <strong>'N'</strong>
197 targetSdkVersion <strong>'N'</strong>
198 ...
199 }
200 ...
201}</pre>
202
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800203
smain@google.com0a03f312016-03-07 16:38:37 -0800204<h3 id="create">Create a new project</h3>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800205
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800206
smain@google.com67894042016-03-08 21:14:47 -0800207<p>To create a new project for development with the Android N Preview SDK:</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800208
209<ol>
smain@google.com0a03f312016-03-07 16:38:37 -0800210 <li>Click <strong>File > New Project</strong>. and follow the steps until
211 you reach the Target Android Devices page.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800212 </li>
smain@google.com0a03f312016-03-07 16:38:37 -0800213 <li>On this page, select <strong>Phone and Tablet</strong> option.</li>
214 <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum
215 SDK</strong> option list, select
216 <strong>N: Android API 23, N Preview (Preview)</strong>.</li>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800217</ol>
218
smain@google.com0a03f312016-03-07 16:38:37 -0800219
220<h2 id="next">Next Steps</h2>
221
smain@google.com67894042016-03-08 21:14:47 -0800222<ul>
223 <li>Follow the guide to <a
224href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li>
225 <li>Learn more about the Android N platform with
smain@google.com0a03f312016-03-07 16:38:37 -0800226<a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a>
227and <a href="{@docRoot}preview/api-overview.html">Android N APIs
smain@google.com67894042016-03-08 21:14:47 -0800228and Features</a>.</li>
229</ul>
smain@google.com0a03f312016-03-07 16:38:37 -0800230