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 | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 50 | <p>If you don't have it, <a href="{@docRoot}sdk/">download Android Studio |
| 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 | |
| 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.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 88 | <tr> |
| 89 | <th scope="col">Documentation</th> |
| 90 | <th scope="col">Checksums</th> |
| 91 | </tr> |
| 92 | <tr> |
| 93 | <td style="white-space: nowrap"> |
Joe Fernandez | 922b5e4 | 2016-04-12 17:36:49 -0700 | [diff] [blame] | 94 | <a href="{@docRoot}shareables/preview/n-preview-2-docs.zip" |
| 95 | >n-preview-2-docs.zip</a></td> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 96 | <td width="100%"> |
Joe Fernandez | 922b5e4 | 2016-04-12 17:36:49 -0700 | [diff] [blame] | 97 | MD5: c02732760f468bd97cd94c1b76361229<br> |
| 98 | SHA-1: 591eabe168c909799f6d8dcbe7b126c25ea8b04d |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 99 | </td> |
| 100 | </tr> |
| 101 | <table> |
| 102 | |
| 103 | |
| 104 | |
Mary Yanchar | 1986a6e | 2016-03-30 13:56:12 -0700 | [diff] [blame] | 105 | <h2 id="java8">Get the Java 8 JDK</h2> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 106 | |
Mary Yanchar | 1986a6e | 2016-03-30 13:56:12 -0700 | [diff] [blame] | 107 | <p>To compile your app against the Android N platform and use some tools with |
| 108 | Android Studio 2.1, you need to install the Java 8 Developer Kit (JDK 8). So, if |
| 109 | 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] | 110 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 111 | <p>Then set the JDK version in Android Studio as follows:</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 112 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 113 | <ol> |
| 114 | <li>Open an Android project in Android Studio, then open the |
| 115 | Project Structure dialog by selecting <strong>File > |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 116 | Project Structure</strong>. (Alternatively, you can set the default |
| 117 | for all projects by selecting <strong>File > Other Settings > |
| 118 | Default Project Structure</strong>.) |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 119 | </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.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 123 | Java 8 JDK (click the button on the right |
| 124 | to browse your files), then click <strong>OK</strong>. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 125 | </li> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 126 | </ol> |
| 127 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 128 | <img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700" |
| 129 | alt="" /> |
| 130 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 131 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 132 | <h2 id="create-update">Update or Create a Project</h2> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 133 | |
| 134 | <p> |
David Friedman | fffa8ac | 2016-03-07 22:13:29 -0800 | [diff] [blame] | 135 | To use the Android N APIs, your project must be configured appropriately. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 136 | </p> |
| 137 | |
smain@google.com | a329ffd | 2016-03-09 00:00:37 -0800 | [diff] [blame] | 138 | <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> |
| 140 | for information about the supported Java 8 features and |
| 141 | how to configure your project with the Jack compiler.</p> |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 142 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 143 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 144 | <h3 id="update">Update an existing project</h3> |
| 145 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 146 | <p>Open the |
| 147 | <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] | 148 | follows: |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 149 | </p> |
| 150 | |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 151 | <pre> |
| 152 | android { |
| 153 | compileSdkVersion <strong>'android-N'</strong> |
smain@google.com | 8ac737d | 2016-04-22 15:27:28 -0700 | [diff] [blame] | 154 | buildToolsVersion <strong>'24.0.0-rc3'</strong> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 155 | ... |
| 156 | |
| 157 | defaultConfig { |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 158 | minSdkVersion <strong>'N'</strong> |
| 159 | targetSdkVersion <strong>'N'</strong> |
| 160 | ... |
| 161 | } |
| 162 | ... |
| 163 | }</pre> |
| 164 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 165 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 166 | <h3 id="create">Create a new project</h3> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 167 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 168 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 169 | <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] | 170 | |
| 171 | <ol> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 172 | <li>Click <strong>File > New Project</strong>. and follow the steps until |
| 173 | you reach the Target Android Devices page. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 174 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 175 | <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 Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 179 | </ol> |
| 180 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 181 | |
| 182 | <h2 id="next">Next Steps</h2> |
| 183 | |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 184 | <ul> |
| 185 | <li>Follow the guide to <a |
| 186 | href="{@docRoot}preview/download.html">Test on an Android N Device</a>.</li> |
| 187 | <li>Learn more about the Android N platform with |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 188 | <a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a> |
| 189 | and <a href="{@docRoot}preview/api-overview.html">Android N APIs |
smain@google.com | 6789404 | 2016-03-08 21:14:47 -0800 | [diff] [blame] | 190 | and Features</a>.</li> |
| 191 | </ul> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 192 | |