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> |
Mary Yanchar | 1986a6e | 2016-03-30 13:56:12 -0700 | [diff] [blame] | 18 | <li><a href="#java8">Get the Java 8 JDK</a></li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 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 | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 35 | <h2 id="get-as13">Get Android Studio 2.1</h2> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 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, |
smain@google.com | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 44 | as described below.</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 45 | |
smain@google.com | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 46 | <p>If you already have Android Studio installed, make sure you have Android |
| 47 | Studio 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.com | c4bb9a3 | 2016-03-08 13:27:37 -0800 | [diff] [blame] | 49 | |
smain@google.com | 04de2d2 | 2016-05-18 15:28:59 -0700 | [diff] [blame] | 50 | <p>If you don't have it, <a href="{@docRoot}studio/">download Android Studio |
smain@google.com | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 51 | 2.1 here</a>.</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 52 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 53 | |
| 54 | <h2 id="get-sdk">Get the N Preview SDK</h2> |
| 55 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 56 | <p>To start developing with Android N APIs, you need to install the |
| 57 | Android N Preview SDK in Android Studio as follows:</p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 58 | |
| 59 | <ol> |
smain@google.com | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 60 | <li>Open the SDK Manager by clicking <strong>Tools > Android > |
| 61 | SDK Manager</strong>.</li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 62 | |
smain@google.com | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 63 | <li>In the <strong>SDK Platforms</strong> tab, select the |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 64 | <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 Fernandez | 98b0ec6 | 2016-03-08 22:32:51 -0800 | [diff] [blame] | 77 | <h3 id="docs-dl">Get the N Preview reference documentation</h3> |
| 78 | |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 79 | <p>Beginning with the Preview 4 release, the API reference for the |
| 80 | N platform (API level 24) is now available online at <a href= |
Andrew Solovay | 9e9a3bb | 2016-06-09 13:06:30 -0700 | [diff] [blame] | 81 | "{@docRoot}reference/">developer.android.com/reference/</a>. |
| 82 | </p> |
| 83 | |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 84 | <p>If you'd like an offline copy of the API reference, you can download it |
| 85 | from the following table. The download also includes an incremental diff report |
| 86 | for API changes between the Preview 3 and Preview 4 release, which is not |
| 87 | available online.</p> |
Joe Fernandez | 98b0ec6 | 2016-03-08 22:32:51 -0800 | [diff] [blame] | 88 | |
| 89 | <table> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 90 | <tr> |
| 91 | <th scope="col">Documentation</th> |
| 92 | <th scope="col">Checksums</th> |
| 93 | </tr> |
| 94 | <tr> |
| 95 | <td style="white-space: nowrap"> |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 96 | <a href="{@docRoot}shareables/preview/n-preview-4-docs.zip" |
| 97 | >n-preview-4-docs.zip</a></td> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 98 | <td width="100%"> |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 99 | MD5: f853e3ba0707083336dfa780b8fed9a7<br> |
| 100 | SHA-1: 36fcbc497cc2e63b1bc1d629c304b0ba43a88946 |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 101 | </td> |
| 102 | </tr> |
Amanda Kassay | c68d876 | 2016-05-25 20:59:53 +0000 | [diff] [blame] | 103 | </table> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 104 | |
| 105 | |
| 106 | |
Mary Yanchar | 1986a6e | 2016-03-30 13:56:12 -0700 | [diff] [blame] | 107 | <h2 id="java8">Get the Java 8 JDK</h2> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 108 | |
Mary Yanchar | 1986a6e | 2016-03-30 13:56:12 -0700 | [diff] [blame] | 109 | <p>To compile your app against the Android N platform and use some tools with |
| 110 | Android Studio 2.1, you need to install the Java 8 Developer Kit (JDK 8). So, if |
| 111 | you don't already have the latest version, download JDK 8 now.</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 112 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 113 | <p>Then set the JDK version in Android Studio as follows:</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 114 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 115 | <ol> |
| 116 | <li>Open an Android project in Android Studio, then open the |
| 117 | Project Structure dialog by selecting <strong>File > |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 118 | Project Structure</strong>. (Alternatively, you can set the default |
| 119 | for all projects by selecting <strong>File > Other Settings > |
| 120 | Default Project Structure</strong>.) |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 121 | </li> |
| 122 | <li>In the left panel of the dialog, click <strong>SDK Location</strong>. |
| 123 | </li> |
| 124 | <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] | 125 | Java 8 JDK (click the button on the right |
| 126 | to browse your files), then click <strong>OK</strong>. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 127 | </li> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 128 | </ol> |
| 129 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 130 | <img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700" |
| 131 | alt="" /> |
| 132 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 133 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 134 | <h2 id="create-update">Update or Create a Project</h2> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 135 | |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 136 | <p>Now that the N platform API level is "24" instead |
| 137 | of "N", you can configure your projects normally with this API level (and even |
| 138 | publish your apps compiled with API 24 on Google Play). Just be sure that you've |
| 139 | updated your project to use <strong>Android SDK Build Tools 24.0.0</strong> and |
| 140 | <strong>Android SDK Platform-Tools 24.0.0</strong>.</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 141 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 142 | <p>If you plan to use Java 8 language features, you should also read |
| 143 | <a href="{@docRoot}preview/j8-jack.html">Java 8 Language Features</a> |
| 144 | for information about the supported Java 8 features and |
| 145 | how to configure your project with the Jack compiler.</p> |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 146 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 147 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 148 | <h3 id="update">Update an existing project</h3> |
| 149 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 150 | <p>Open the |
| 151 | <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] | 152 | follows: |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 153 | </p> |
| 154 | |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 155 | <pre> |
| 156 | android { |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 157 | compileSdkVersion <strong>24</strong> |
| 158 | buildToolsVersion <strong>'24.0.0'</strong> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 159 | ... |
| 160 | |
| 161 | defaultConfig { |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 162 | targetSdkVersion <strong>24</strong> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 163 | ... |
| 164 | } |
| 165 | ... |
| 166 | }</pre> |
| 167 | |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 168 | <p>Now that the API level 24 is final, you can compile against it and keep your |
| 169 | <code>minSdkVersion</code> to whatever version is appropriate for your app.</p> |
| 170 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 171 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 172 | <h3 id="create">Create a new project</h3> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 173 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 174 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 175 | <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] | 176 | |
| 177 | <ol> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 178 | <li>Click <strong>File > New Project</strong>. and follow the steps until |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 179 | you reach the <strong>Target Android Devices</strong> page. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 180 | </li> |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 181 | <li>On this page, select the <strong>Phone and Tablet</strong> check box.</li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 182 | <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum |
| 183 | SDK</strong> option list, select |
smain@google.com | ef11c2e | 2016-06-14 17:03:36 -0700 | [diff] [blame] | 184 | <strong>API 24: Android 6.X (N Preview)</strong>.</li> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 185 | </ol> |
| 186 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 187 | |
| 188 | <h2 id="next">Next Steps</h2> |
| 189 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 190 | <ul> |
| 191 | <li>Follow the guide to <a |
| 192 | href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li> |
| 193 | <li>Learn more about the Android N platform with |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 194 | <a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a> |
| 195 | and <a href="{@docRoot}preview/api-overview.html">Android N APIs |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 196 | and Features</a>.</li> |
| 197 | </ul> |