Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 1 | page.title=Set Up the Preview |
Dirk Dougherty | 43eb951 | 2016-03-03 14:53:16 -0800 | [diff] [blame] | 2 | meta.keywords="preview", "android" |
| 3 | page.tags="preview", "developer preview" |
| 4 | page.image=images/cards/card-n-sdk_2x.png |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 5 | |
| 6 | @jd:body |
| 7 | |
| 8 | |
| 9 | <div id="qv-wrapper"> |
| 10 | <div id="qv"> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 11 | <ol> |
| 12 | <li><a href="#get-as13">Get Android Studio 2.1</a></li> |
Joe Fernandez | 98b0ec6 | 2016-03-08 22:32:51 -0800 | [diff] [blame] | 13 | <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.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 18 | <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 Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 22 | </div> |
| 23 | </div> |
| 24 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 25 | <p>To develop apps for the Android N Preview, you need to make some updates |
| 26 | to your developer environment, as described on this page.</p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 27 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 28 | <p>To simply test your app's compatibility on the |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 29 | Android N system image, follow the guide to <a |
smain@google.com | 3254f8c | 2016-03-08 17:25:50 -0800 | [diff] [blame] | 30 | href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 31 | |
smain@google.com | 02573e0 | 2016-03-08 18:42:51 -0800 | [diff] [blame] | 32 | <img src="{@docRoot}preview/images/n-preview-setup.png" width="700" alt="" /> |
| 33 | |
| 34 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 35 | <h2 id="get-as13">Get Android Studio 2.1 (preview)</h2> |
| 36 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 37 | <p>The Android N platform adds support for <a |
| 38 | href="{@docRoot}preview/j8-jack.html">Java 8 language features</a>, |
| 39 | which require a new compiler called Jack. The latest version of Jack |
| 40 | is currently supported only in Android Studio 2.1. So if you want to |
| 41 | use Java 8 language features, you need to use Android Studio 2.1 to |
| 42 | build your app. Otherwise, you don't need to use the Jack compiler, but you |
| 43 | still need to update to JDK 8 to compile against the Android N platform, |
| 44 | as described below. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 45 | </p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 46 | |
smain@google.com | c4bb9a3 | 2016-03-08 13:27:37 -0800 | [diff] [blame] | 47 | <iframe width="400" height="225" src="//www.youtube.com/embed/SBbWGxXCMqQ?autohide=1&showinfo=0" frameborder="0" allowfullscreen="" style="float: right; margin: 0 0 20px 20px;"></iframe> |
| 48 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 49 | <p>Android Studio 2.1 is currently available as a preview in the canary |
smain@google.com | c4bb9a3 | 2016-03-08 13:27:37 -0800 | [diff] [blame] | 50 | release channel. If you already |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 51 | have Android Studio and don't want to update to the canary channel, you can |
| 52 | download Android Studio 2.1 as a separate installation and use it |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 53 | for development with Android N, leaving your primary Android Studio |
| 54 | environment unaffected.</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 55 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 56 | <p>To download Android Studio 2.1 as a separate installation, follow these |
| 57 | steps (or if you want to receive Android Studio 2.1 as an update to your |
smain@google.com | c165dbd | 2016-04-06 16:12:16 -0700 | [diff] [blame^] | 58 | existing installation, skip to step 6):</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 59 | |
| 60 | <ol> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 61 | <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 Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 67 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 68 | <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> |
smain@google.com | c165dbd | 2016-04-06 16:12:16 -0700 | [diff] [blame^] | 70 | <li>In the setup wizard, click <strong>Next</strong> a couple times to |
| 71 | reach the SDK Components Setup screen. Here, |
| 72 | you must set a different path for the <strong>Android SDK Location</strong>. |
| 73 | It can be any directory you want, but it must not be the default path, which |
| 74 | is the same directory used by your original version of Android Studio (unless |
| 75 | you changed that one yourself). The SDK location for Android Studio 2.1 |
| 76 | must be different because the N Preview SDK packages are not compatible with |
| 77 | versions of Android Studio lower than 2.1.</p> |
| 78 | </li> |
| 79 | <li>Continue with the setup wizard until you reach the Android Studio IDE.</li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 80 | <li>Open the Settings dialog |
| 81 | (<strong>File > Settings</strong> on Windows/Linux, or |
| 82 | <strong>Android Studio > Preferences</strong> on Mac). In the left |
| 83 | panel, select <strong>Appearance & Behavior > System Settings > |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 84 | Updates</strong>. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 85 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 86 | <li>On the Updates panel, select the <strong>Automatically |
| 87 | check updates for</strong> check box and select |
| 88 | <strong>Canary Channel</strong> from the drop-down list. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 89 | </li> |
| 90 | </ol> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 91 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 92 | <p>Keep this settings window open for the next step.</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 93 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 94 | |
| 95 | <h2 id="get-sdk">Get the N Preview SDK</h2> |
| 96 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 97 | <p>To start developing with Android N APIs, you need to install the |
| 98 | Android N Preview SDK in Android Studio as follows:</p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 99 | |
| 100 | <ol> |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 101 | <li>While still viewing the Updates panel (step 4 from above), |
| 102 | select the <strong>Automatically |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 103 | check updates for Android SDK</strong> check box and select |
| 104 | <strong>Preview Channel</strong> from the drop-down list. |
| 105 | </li> |
| 106 | <li>Click <strong>Check Now</strong>.</li> |
| 107 | |
| 108 | <li>In the left panel, select <strong>Appearance & Behavior > |
| 109 | System Settings > Android SDK</strong>. |
| 110 | |
| 111 | <li>Click the <strong>SDK Platforms</strong> tab, then select the |
| 112 | <strong>Android N Preview</strong> check box.</li> |
| 113 | |
| 114 | <li>Click the <strong>SDK Tools</strong> tab, then select the |
| 115 | <strong>Android SDK Build Tools</strong>, <strong>Android SDK |
| 116 | Platform-Tools</strong>, and <strong>Android SDK Tools</strong> check |
| 117 | boxes. |
| 118 | </li> |
| 119 | |
| 120 | <li>Click <strong>OK</strong>, then accept the licensing |
| 121 | agreements for any packages that need to be installed. |
| 122 | </li> |
| 123 | </ol> |
| 124 | |
Joe Fernandez | 98b0ec6 | 2016-03-08 22:32:51 -0800 | [diff] [blame] | 125 | <h3 id="docs-dl">Get the N Preview reference documentation</h3> |
| 126 | |
| 127 | <p> |
| 128 | Detailed information about the Android N APIs is available in the N Preview |
| 129 | reference documentation, which you can download from the following table. |
| 130 | This package contains an abridged, offline version of the Android developer |
| 131 | web site, and includes an updated API reference for the Android N APIs and an |
| 132 | API difference report. |
| 133 | </p> |
| 134 | |
| 135 | <table> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 136 | <tr> |
| 137 | <th scope="col">Documentation</th> |
| 138 | <th scope="col">Checksums</th> |
| 139 | </tr> |
| 140 | <tr> |
| 141 | <td style="white-space: nowrap"> |
Joe Fernandez | 0076ded | 2016-03-09 09:44:25 -0800 | [diff] [blame] | 142 | <a href="{@docRoot}shareables/preview/n-preview-1-docs.zip" |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 143 | >n-preview-1-docs.zip</a></td> |
| 144 | <td width="100%"> |
Joe Fernandez | 55d1921 | 2016-03-08 21:49:52 -0800 | [diff] [blame] | 145 | MD5: 4ab33ccbe698f46f125cc5b807cf9c2f<br> |
| 146 | SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5 |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 147 | </td> |
| 148 | </tr> |
| 149 | <table> |
| 150 | |
| 151 | |
| 152 | |
| 153 | <h2 id="java8">Get the Java 8 JDK and JRE</h2> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 154 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 155 | <p>To compile your app against the Android N platform, you need to use |
| 156 | the Java 8 Developer Kit (JDK 8), and in order to use some tools with Android |
| 157 | Studio 2.1, you need to install the Java 8 Runtime Environment (JRE 8). So, if |
| 158 | you don't have the latest version of each already, download JDK 8 and JRE 8 |
| 159 | now.</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 160 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 161 | <p>Then set the JDK version in Android Studio as follows:</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 162 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 163 | <ol> |
| 164 | <li>Open an Android project in Android Studio, then open the |
| 165 | Project Structure dialog by selecting <strong>File > |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 166 | Project Structure</strong>. (Alternatively, you can set the default |
| 167 | for all projects by selecting <strong>File > Other Settings > |
| 168 | Default Project Structure</strong>.) |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 169 | </li> |
| 170 | <li>In the left panel of the dialog, click <strong>SDK Location</strong>. |
| 171 | </li> |
| 172 | <li>In the <strong>JDK Location</strong> field, enter the location of the |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 173 | Java 8 JDK (click the button on the right |
| 174 | to browse your files), then click <strong>OK</strong>. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 175 | </li> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 176 | </ol> |
| 177 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 178 | <img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700" |
| 179 | alt="" /> |
| 180 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 181 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 182 | <h2 id="create-update">Update or Create a Project</h2> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 183 | |
| 184 | <p> |
David Friedman | fffa8ac | 2016-03-07 22:13:29 -0800 | [diff] [blame] | 185 | To use the Android N APIs, your project must be configured appropriately. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 186 | </p> |
| 187 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 188 | <p>If you plan to use Java 8 language features, you should also read |
| 189 | <a href="{@docRoot}preview/j8-jack.html">Java 8 Language Features</a> |
| 190 | for information about the supported Java 8 features and |
| 191 | how to configure your project with the Jack compiler.</p> |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 192 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 193 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 194 | <h3 id="update">Update an existing project</h3> |
| 195 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 196 | <p>Open the |
| 197 | <code>build.gradle</code> file for your module and update the values as |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 198 | follows: |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 199 | </p> |
| 200 | |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 201 | <pre> |
| 202 | android { |
| 203 | compileSdkVersion <strong>'android-N'</strong> |
Andrew Solovay | dfd4b8f | 2016-03-10 15:58:01 -0800 | [diff] [blame] | 204 | buildToolsVersion <strong>'24.0.0-rc1'</strong> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 205 | ... |
| 206 | |
| 207 | defaultConfig { |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 208 | minSdkVersion <strong>'N'</strong> |
| 209 | targetSdkVersion <strong>'N'</strong> |
| 210 | ... |
| 211 | } |
| 212 | ... |
| 213 | }</pre> |
| 214 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 215 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 216 | <h3 id="create">Create a new project</h3> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 217 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 218 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 219 | <p>To create a new project for development with the Android N Preview SDK:</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 220 | |
| 221 | <ol> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 222 | <li>Click <strong>File > New Project</strong>. and follow the steps until |
| 223 | you reach the Target Android Devices page. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 224 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 225 | <li>On this page, select <strong>Phone and Tablet</strong> option.</li> |
| 226 | <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum |
| 227 | SDK</strong> option list, select |
| 228 | <strong>N: Android API 23, N Preview (Preview)</strong>.</li> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 229 | </ol> |
| 230 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 231 | |
| 232 | <h2 id="next">Next Steps</h2> |
| 233 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 234 | <ul> |
| 235 | <li>Follow the guide to <a |
| 236 | href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li> |
| 237 | <li>Learn more about the Android N platform with |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 238 | <a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a> |
| 239 | and <a href="{@docRoot}preview/api-overview.html">Android N APIs |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 240 | and Features</a>.</li> |
| 241 | </ul> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 242 | |