blob: 65be22042fe9c446df9dc9ea00cfbe275c0e760c [file] [log] [blame]
David Friedmanfffa8ac2016-03-07 22:13:29 -08001page.title=Set Up to Develop for Android N
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>
smain@google.com0a03f312016-03-07 16:38:37 -080018 <li><a href="#java8">Get the Java 8 JDK and JRE</a></li>
19 <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.com67894042016-03-08 21:14:47 -080028<p>To instead simply test your app's compatibility on the
29Android 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.com67894042016-03-08 21:14:47 -080037<p>The Android N platform adds support for Java 8 language features,
38which are supported only with a new compiler called Jack. The latest Jack
39compiler is currently supported only in Android Studio 2.1. So if you want to
40use Java 8 language features, then you need to use Android Studio 2.1 to
41build your app.
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080042</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080043
smain@google.comc4bb9a32016-03-08 13:27:37 -080044<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>
45
smain@google.com0a03f312016-03-07 16:38:37 -080046<p>Android Studio 2.1 is currently available as a preview in the canary
smain@google.comc4bb9a32016-03-08 13:27:37 -080047release channel. If you already
smain@google.com0a03f312016-03-07 16:38:37 -080048have Android Studio and don't want to update to the canary channel, you can
49download Android Studio 2.1 as a separate installation and use it
David Friedmanfffa8ac2016-03-07 22:13:29 -080050with Android N, leaving your primary Android Studio environment
smain@google.com0a03f312016-03-07 16:38:37 -080051unaffected.</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080052
smain@google.com0a03f312016-03-07 16:38:37 -080053<p>To download Android Studio 2.1 as a separate installation, follow these
54steps (or if you want to receive Android Studio 2.1 as an update to your
55existing installation, skip to step 4):</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -080056
57<ol>
smain@google.com0a03f312016-03-07 16:38:37 -080058 <li>Edit the name of your
59 existing Android Studio installation and append the version number. This way,
60 when you install the new version, it will not override the existing one.</li>
61 <li>Download the appropriate ZIP file for your operating system from the
62 <a href="http://tools.android.com/download/studio/canary/latest"
63 >canary channel download page</a>.
Dirk Dougherty5748bc42016-02-06 18:24:32 -080064 </li>
smain@google.com0a03f312016-03-07 16:38:37 -080065 <li>Unzip the package and move the Android Studio 2.1 contents to the
66 appropriate location for applications on your system, then launch it.</li>
67 <li>Open the Settings dialog
68 (<strong>File &gt; Settings</strong> on Windows/Linux, or
69 <strong>Android Studio &gt; Preferences</strong> on Mac). In the left
70 panel, select <strong>Appearance &amp; Behavior &gt; System Settings &gt;
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080071 Updates</strong>.
Dirk Dougherty5748bc42016-02-06 18:24:32 -080072 </li>
smain@google.com0a03f312016-03-07 16:38:37 -080073 <li>On the Updates panel, select the <strong>Automatically
74 check updates for</strong> check box and select
75 <strong>Canary Channel</strong> from the drop-down list.
Dirk Dougherty5748bc42016-02-06 18:24:32 -080076 </li>
77</ol>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080078
smain@google.com0a03f312016-03-07 16:38:37 -080079<p>Keep this settings window open for the next step.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -080080
smain@google.com0a03f312016-03-07 16:38:37 -080081
82<h2 id="get-sdk">Get the N Preview SDK</h2>
83
smain@google.com67894042016-03-08 21:14:47 -080084<p>To start developing with Android N APIs, you need to install the
85Android N Preview SDK in Android Studio as follows:</p>
smain@google.com0a03f312016-03-07 16:38:37 -080086
87<ol>
88 <li>While still viewing the Updates panel from the previous
89 procedure, select the <strong>Automatically
90 check updates for Android SDK</strong> check box and select
91 <strong>Preview Channel</strong> from the drop-down list.
92 </li>
93 <li>Click <strong>Check Now</strong>.</li>
94
95 <li>In the left panel, select <strong>Appearance &amp; Behavior &gt;
96 System Settings &gt; Android SDK</strong>.
97
98 <li>Click the <strong>SDK Platforms</strong> tab, then select the
99 <strong>Android N Preview</strong> check box.</li>
100
101 <li>Click the <strong>SDK Tools</strong> tab, then select the
102 <strong>Android SDK Build Tools</strong>, <strong>Android SDK
103 Platform-Tools</strong>, and <strong>Android SDK Tools</strong> check
104 boxes.
105 </li>
106
107 <li>Click <strong>OK</strong>, then accept the licensing
108 agreements for any packages that need to be installed.
109 </li>
110</ol>
111
smain@google.com0a03f312016-03-07 16:38:37 -0800112
Joe Fernandez98b0ec62016-03-08 22:32:51 -0800113<h3 id="docs-dl">Get the N Preview reference documentation</h3>
114
115<p>
116 Detailed information about the Android N APIs is available in the N Preview
117 reference documentation, which you can download from the following table.
118 This package contains an abridged, offline version of the Android developer
119 web site, and includes an updated API reference for the Android N APIs and an
120 API difference report.
121</p>
122
123<table>
smain@google.com0a03f312016-03-07 16:38:37 -0800124 <tr>
125 <th scope="col">Documentation</th>
126 <th scope="col">Checksums</th>
127 </tr>
128 <tr>
129 <td style="white-space: nowrap">
smain@google.com67894042016-03-08 21:14:47 -0800130 <a href="https://storage.googleapis.com/androiddevelopers/preview/n-preview-1-docs.zip"
smain@google.com0a03f312016-03-07 16:38:37 -0800131 >n-preview-1-docs.zip</a></td>
132 <td width="100%">
Joe Fernandez55d19212016-03-08 21:49:52 -0800133 MD5: 4ab33ccbe698f46f125cc5b807cf9c2f<br>
134 SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
smain@google.com0a03f312016-03-07 16:38:37 -0800135 </td>
136 </tr>
137<table>
138
139
140
141<h2 id="java8">Get the Java 8 JDK and JRE</h2>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800142
smain@google.com67894042016-03-08 21:14:47 -0800143<p>You also need to update your JDK for Java 8 and install the
144 Java 8 Runtime Environment (JRE) to run some
Joe Fernandez82211ee2016-03-08 16:44:08 -0800145 tools included in Android Studio 2.1. So, if you don't have the latest
smain@google.com67894042016-03-08 21:14:47 -0800146 version of each already, download JDK 8 and JRE 8 now.</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800147
smain@google.com0a03f312016-03-07 16:38:37 -0800148<p>With Java 8 installed, set the JDK version in Android Studio as follows:</p>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800149
smain@google.com0a03f312016-03-07 16:38:37 -0800150<ol>
151 <li>Open an Android project in Android Studio, then open the
152 Project Structure dialog by selecting <strong>File &gt;
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800153 Project Structure</strong>.
154 </li>
155 <li>In the left panel of the dialog, click <strong>SDK Location</strong>.
156 </li>
157 <li>In the <strong>JDK Location</strong> field, enter the location of the
smain@google.com0a03f312016-03-07 16:38:37 -0800158 Java 8 JDK, then click <strong>OK</strong>.
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800159 </li>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800160</ol>
161
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800162
smain@google.com0a03f312016-03-07 16:38:37 -0800163<h2 id="create-update">Update or Create a Project</h2>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800164
165<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800166 To use the Android N APIs, your project must be configured appropriately.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800167</p>
168
smain@google.com67894042016-03-08 21:14:47 -0800169<p>If you plan to use Java 8 language features, you should read
170<a href="{@docRoot}preview/j8-jack.html">Using Java 8 Language Features</a>
171for information about how to configure your project and the supported
172Java 8 features.</p>
173
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800174
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800175<h3 id="update">Update an existing project</h3>
176
smain@google.com0a03f312016-03-07 16:38:37 -0800177<p>Open the
178 <code>build.gradle</code> file for your module and update the values as
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800179 follows:
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800180</p>
181
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800182<pre>
183android {
184 compileSdkVersion <strong>'android-N'</strong>
smain@google.com0a03f312016-03-07 16:38:37 -0800185 buildToolsVersion <strong>24.0.0</strong>
Joe Fernandez7f94b7e2016-03-02 21:30:31 -0800186 ...
187
188 defaultConfig {
189 ...
190 minSdkVersion <strong>'N'</strong>
191 targetSdkVersion <strong>'N'</strong>
192 ...
193 }
194 ...
195}</pre>
196
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800197
smain@google.com0a03f312016-03-07 16:38:37 -0800198<h3 id="create">Create a new project</h3>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800199
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800200
smain@google.com67894042016-03-08 21:14:47 -0800201<p>To create a new project for development with the Android N Preview SDK:</p>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800202
203<ol>
smain@google.com0a03f312016-03-07 16:38:37 -0800204 <li>Click <strong>File > New Project</strong>. and follow the steps until
205 you reach the Target Android Devices page.
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800206 </li>
smain@google.com0a03f312016-03-07 16:38:37 -0800207 <li>On this page, select <strong>Phone and Tablet</strong> option.</li>
208 <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum
209 SDK</strong> option list, select
210 <strong>N: Android API 23, N Preview (Preview)</strong>.</li>
Dirk Dougherty5748bc42016-02-06 18:24:32 -0800211</ol>
212
smain@google.com0a03f312016-03-07 16:38:37 -0800213
214<h2 id="next">Next Steps</h2>
215
smain@google.com67894042016-03-08 21:14:47 -0800216<ul>
217 <li>Follow the guide to <a
218href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li>
219 <li>Learn more about the Android N platform with
smain@google.com0a03f312016-03-07 16:38:37 -0800220<a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a>
221and <a href="{@docRoot}preview/api-overview.html">Android N APIs
smain@google.com67894042016-03-08 21:14:47 -0800222and Features</a>.</li>
223</ul>
smain@google.com0a03f312016-03-07 16:38:37 -0800224