blob: 60568acf2cd1525a7d8577232ab408025fe9e195 [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.com8ac737d2016-04-22 15:27:28 -070050<p>If you don't have it, <a href="{@docRoot}sdk/">download Android Studio
512.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
79<p>
80 Detailed information about the Android N APIs is available in the N Preview
81 reference documentation, which you can download from the following table.
82 This package contains an abridged, offline version of the Android developer
83 web site, and includes an updated API reference for the Android N APIs and an
84 API difference report.
85</p>
86
87<table>
smain@google.com0a03f312016-03-07 16:38:37 -080088 <tr>
89 <th scope="col">Documentation</th>
90 <th scope="col">Checksums</th>
91 </tr>
92 <tr>
93 <td style="white-space: nowrap">
Joe Fernandez922b5e42016-04-12 17:36:49 -070094 <a href="{@docRoot}shareables/preview/n-preview-2-docs.zip"
95 >n-preview-2-docs.zip</a></td>
smain@google.com0a03f312016-03-07 16:38:37 -080096 <td width="100%">
Joe Fernandez922b5e42016-04-12 17:36:49 -070097 MD5: c02732760f468bd97cd94c1b76361229<br>
98 SHA-1: 591eabe168c909799f6d8dcbe7b126c25ea8b04d
smain@google.com0a03f312016-03-07 16:38:37 -080099 </td>
100 </tr>
101<table>
102
103
104
Mary Yanchar1986a6e2016-03-30 13:56:12 -0700105<h2 id="java8">Get the Java 8 JDK</h2>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800106
Mary Yanchar1986a6e2016-03-30 13:56:12 -0700107<p>To compile your app against the Android N platform and use some tools with
108Android Studio 2.1, you need to install the Java 8 Developer Kit (JDK 8). So, if
109you don't already have the latest version, download JDK 8 now.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800110
smain@google.coma329ffd2016-03-09 00:00:37 -0800111<p>Then set the JDK version in Android Studio as follows:</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800112
smain@google.com0a03f312016-03-07 16:38:37 -0800113<ol>
114 <li>Open an Android project in Android Studio, then open the
115 Project Structure dialog by selecting <strong>File &gt;
smain@google.coma329ffd2016-03-09 00:00:37 -0800116 Project Structure</strong>. (Alternatively, you can set the default
117 for all projects by selecting <strong>File &gt; Other Settings &gt;
118 Default Project Structure</strong>.)
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800119 </li>
120 <li>In the left panel of the dialog, click <strong>SDK Location</strong>.
121 </li>
122 <li>In the <strong>JDK Location</strong> field, enter the location of the
smain@google.coma329ffd2016-03-09 00:00:37 -0800123 Java 8 JDK (click the button on the right
124 to browse your files), then click <strong>OK</strong>.
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800125 </li>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800126</ol>
127
smain@google.coma329ffd2016-03-09 00:00:37 -0800128<img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700"
129 alt="" />
130
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800131
smain@google.com0a03f312016-03-07 16:38:37 -0800132<h2 id="create-update">Update or Create a Project</h2>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800133
134<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800135 To use the Android N APIs, your project must be configured appropriately.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800136</p>
137
smain@google.coma329ffd2016-03-09 00:00:37 -0800138<p>If you plan to use Java 8 language features, you should also read
139<a href="{@docRoot}preview/j8-jack.html">Java 8 Language Features</a>
140for information about the supported Java 8 features and
141how to configure your project with the Jack compiler.</p>
smain@google.com67894042016-03-08 21:14:47 -0800142
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800143
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800144<h3 id="update">Update an existing project</h3>
145
smain@google.com0a03f312016-03-07 16:38:37 -0800146<p>Open the
147 <code>build.gradle</code> file for your module and update the values as
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800148 follows:
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800149</p>
150
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800151<pre>
152android {
153 compileSdkVersion <strong>'android-N'</strong>
smain@google.com8ac737d2016-04-22 15:27:28 -0700154 buildToolsVersion <strong>'24.0.0-rc3'</strong>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800155 ...
156
157 defaultConfig {
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800158 minSdkVersion <strong>'N'</strong>
159 targetSdkVersion <strong>'N'</strong>
160 ...
161 }
162 ...
163}</pre>
164
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800165
smain@google.com0a03f312016-03-07 16:38:37 -0800166<h3 id="create">Create a new project</h3>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800167
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800168
smain@google.com67894042016-03-08 21:14:47 -0800169<p>To create a new project for development with the Android N Preview SDK:</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800170
171<ol>
smain@google.com0a03f312016-03-07 16:38:37 -0800172 <li>Click <strong>File > New Project</strong>. and follow the steps until
173 you reach the Target Android Devices page.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800174 </li>
smain@google.com0a03f312016-03-07 16:38:37 -0800175 <li>On this page, select <strong>Phone and Tablet</strong> option.</li>
176 <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum
177 SDK</strong> option list, select
178 <strong>N: Android API 23, N Preview (Preview)</strong>.</li>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800179</ol>
180
smain@google.com0a03f312016-03-07 16:38:37 -0800181
182<h2 id="next">Next Steps</h2>
183
smain@google.com67894042016-03-08 21:14:47 -0800184<ul>
185 <li>Follow the guide to <a
186href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li>
187 <li>Learn more about the Android N platform with
smain@google.com0a03f312016-03-07 16:38:37 -0800188<a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a>
189and <a href="{@docRoot}preview/api-overview.html">Android N APIs
smain@google.com67894042016-03-08 21:14:47 -0800190and Features</a>.</li>
191</ul>
smain@google.com0a03f312016-03-07 16:38:37 -0800192