blob: 58ca1d0b174a9f9ee8e92be81ecd4ad57a55848b [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.com8ac737d2016-04-22 15:27:28 -070035<h2 id="get-as13">Get Android Studio 2.1</h2>
smain@google.com0a03f312016-03-07 16:38:37 -080036
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,
smain@google.com8ac737d2016-04-22 15:27:28 -070044as described below.</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080045
smain@google.com8ac737d2016-04-22 15:27:28 -070046<p>If you already have Android Studio installed, make sure you have Android
47Studio 2.1 or higher by clicking <strong>Help > Check for Update</strong>
48(on Mac, <strong>Android Studio > Check for Updates</strong>).</p>
smain@google.comc4bb9a32016-03-08 13:27:37 -080049
smain@google.com04de2d22016-05-18 15:28:59 -070050<p>If you don't have it, <a href="{@docRoot}studio/">download Android Studio
smain@google.com8ac737d2016-04-22 15:27:28 -0700512.1 here</a>.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080052
smain@google.com0a03f312016-03-07 16:38:37 -080053
54<h2 id="get-sdk">Get the N Preview SDK</h2>
55
smain@google.com67894042016-03-08 21:14:47 -080056<p>To start developing with Android N APIs, you need to install the
57Android N Preview SDK in Android Studio as follows:</p>
smain@google.com0a03f312016-03-07 16:38:37 -080058
59<ol>
smain@google.com8ac737d2016-04-22 15:27:28 -070060 <li>Open the SDK Manager by clicking <strong>Tools > Android >
61 SDK Manager</strong>.</li>
smain@google.com0a03f312016-03-07 16:38:37 -080062
smain@google.com8ac737d2016-04-22 15:27:28 -070063 <li>In the <strong>SDK Platforms</strong> tab, select the
smain@google.com0a03f312016-03-07 16:38:37 -080064 <strong>Android N Preview</strong> check box.</li>
65
66 <li>Click the <strong>SDK Tools</strong> tab, then select the
67 <strong>Android SDK Build Tools</strong>, <strong>Android SDK
68 Platform-Tools</strong>, and <strong>Android SDK Tools</strong> check
69 boxes.
70 </li>
71
72 <li>Click <strong>OK</strong>, then accept the licensing
73 agreements for any packages that need to be installed.
74 </li>
75</ol>
76
Joe Fernandez98b0ec62016-03-08 22:32:51 -080077<h3 id="docs-dl">Get the N Preview reference documentation</h3>
78
Andrew Solovay9e9a3bb2016-06-09 13:06:30 -070079<p class="note">
80 <strong>Note:</strong> The N Preview (API level 24) reference documentation
81 is now available online at <a href=
82 "{@docRoot}reference/">developer.android.com/reference/</a>.
83</p>
84
Joe Fernandez98b0ec62016-03-08 22:32:51 -080085<p>
86 Detailed information about the Android N APIs is available in the N Preview
87 reference documentation, which you can download from the following table.
88 This package contains an abridged, offline version of the Android developer
89 web site, and includes an updated API reference for the Android N APIs and an
90 API difference report.
91</p>
92
93<table>
smain@google.com0a03f312016-03-07 16:38:37 -080094 <tr>
95 <th scope="col">Documentation</th>
96 <th scope="col">Checksums</th>
97 </tr>
98 <tr>
99 <td style="white-space: nowrap">
David Friedman20237392016-05-17 15:31:25 -0700100 <a href="{@docRoot}shareables/preview/n-preview-3-docs.zip"
101 >n-preview-3-docs.zip</a></td>
smain@google.com0a03f312016-03-07 16:38:37 -0800102 <td width="100%">
David Friedman20237392016-05-17 15:31:25 -0700103 MD5: 19bcfd057a1f9dd01ffbb3d8ff7b8d81<br>
Andrew Solovay9e9a3bb2016-06-09 13:06:30 -0700104 SHA-1: 9224bd4445cd7f653c4c294d362ccb195a2101e7
smain@google.com0a03f312016-03-07 16:38:37 -0800105 </td>
106 </tr>
Amanda Kassayc68d8762016-05-25 20:59:53 +0000107</table>
smain@google.com0a03f312016-03-07 16:38:37 -0800108
109
110
Mary Yanchar1986a6e2016-03-30 13:56:12 -0700111<h2 id="java8">Get the Java 8 JDK</h2>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800112
Mary Yanchar1986a6e2016-03-30 13:56:12 -0700113<p>To compile your app against the Android N platform and use some tools with
114Android Studio 2.1, you need to install the Java 8 Developer Kit (JDK 8). So, if
115you don't already have the latest version, download JDK 8 now.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800116
smain@google.coma329ffd2016-03-09 00:00:37 -0800117<p>Then set the JDK version in Android Studio as follows:</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800118
smain@google.com0a03f312016-03-07 16:38:37 -0800119<ol>
120 <li>Open an Android project in Android Studio, then open the
121 Project Structure dialog by selecting <strong>File &gt;
smain@google.coma329ffd2016-03-09 00:00:37 -0800122 Project Structure</strong>. (Alternatively, you can set the default
123 for all projects by selecting <strong>File &gt; Other Settings &gt;
124 Default Project Structure</strong>.)
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800125 </li>
126 <li>In the left panel of the dialog, click <strong>SDK Location</strong>.
127 </li>
128 <li>In the <strong>JDK Location</strong> field, enter the location of the
smain@google.coma329ffd2016-03-09 00:00:37 -0800129 Java 8 JDK (click the button on the right
130 to browse your files), then click <strong>OK</strong>.
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800131 </li>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800132</ol>
133
smain@google.coma329ffd2016-03-09 00:00:37 -0800134<img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700"
135 alt="" />
136
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800137
smain@google.com0a03f312016-03-07 16:38:37 -0800138<h2 id="create-update">Update or Create a Project</h2>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800139
140<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800141 To use the Android N APIs, your project must be configured appropriately.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800142</p>
143
smain@google.coma329ffd2016-03-09 00:00:37 -0800144<p>If you plan to use Java 8 language features, you should also read
145<a href="{@docRoot}preview/j8-jack.html">Java 8 Language Features</a>
146for information about the supported Java 8 features and
147how to configure your project with the Jack compiler.</p>
smain@google.com67894042016-03-08 21:14:47 -0800148
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800149
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800150<h3 id="update">Update an existing project</h3>
151
smain@google.com0a03f312016-03-07 16:38:37 -0800152<p>Open the
153 <code>build.gradle</code> file for your module and update the values as
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800154 follows:
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800155</p>
156
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800157<pre>
158android {
159 compileSdkVersion <strong>'android-N'</strong>
smain@google.com8ac737d2016-04-22 15:27:28 -0700160 buildToolsVersion <strong>'24.0.0-rc3'</strong>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800161 ...
162
163 defaultConfig {
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800164 minSdkVersion <strong>'N'</strong>
165 targetSdkVersion <strong>'N'</strong>
166 ...
167 }
168 ...
169}</pre>
170
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800171
smain@google.com0a03f312016-03-07 16:38:37 -0800172<h3 id="create">Create a new project</h3>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800173
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800174
smain@google.com67894042016-03-08 21:14:47 -0800175<p>To create a new project for development with the Android N Preview SDK:</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800176
177<ol>
smain@google.com0a03f312016-03-07 16:38:37 -0800178 <li>Click <strong>File > New Project</strong>. and follow the steps until
179 you reach the Target Android Devices page.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800180 </li>
smain@google.com0a03f312016-03-07 16:38:37 -0800181 <li>On this page, select <strong>Phone and Tablet</strong> option.</li>
182 <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum
183 SDK</strong> option list, select
184 <strong>N: Android API 23, N Preview (Preview)</strong>.</li>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800185</ol>
186
smain@google.com0a03f312016-03-07 16:38:37 -0800187
188<h2 id="next">Next Steps</h2>
189
smain@google.com67894042016-03-08 21:14:47 -0800190<ul>
191 <li>Follow the guide to <a
192href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li>
193 <li>Learn more about the Android N platform with
smain@google.com0a03f312016-03-07 16:38:37 -0800194<a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a>
195and <a href="{@docRoot}preview/api-overview.html">Android N APIs
smain@google.com67894042016-03-08 21:14:47 -0800196and Features</a>.</li>
197</ul>