smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 1 | page.title=Set Up to Develop for the N 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> |
| 13 | <li><a href="#get-sdk">Get the N Preview SDK</a></li> |
| 14 | <li><a href="#java8">Get the Java 8 JDK and JRE</a></li> |
| 15 | <li><a href="#create-update">Update or Create a Project</a></li> |
| 16 | <li><a href="#next">Next Steps</a></li> |
| 17 | </ol> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 18 | </div> |
| 19 | </div> |
| 20 | |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 21 | <p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 22 | To develop apps for Android using new APIs in the N Preview and new language |
| 23 | features of Java 8, you need to set up Android Studio 2.1 (preview) as described |
| 24 | on this page.</p> |
| 25 | |
| 26 | <p>If you instead want to simply test your app's forward-compatibility on the |
| 27 | Android N Preview system image, you can instead follow the guide to <a |
| 28 | href="{@docRoot}preview/run-app.html">Run Your App on the N Preview</a>.</p> |
| 29 | |
| 30 | |
| 31 | <h2 id="get-as13">Get Android Studio 2.1 (preview)</h2> |
| 32 | |
| 33 | <p>Developing for the Android N Preview platform requires Java 8 and a new |
| 34 | compiler toolchain called JACK, which is currently supported only in |
| 35 | Android Studio 2.1. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 36 | </p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 37 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 38 | <p>Android Studio 2.1 is currently available as a preview in the canary |
| 39 | release channel—it is still in development. If you already |
| 40 | have Android Studio and don't want to update to the canary channel, you can |
| 41 | download Android Studio 2.1 as a separate installation and use it |
| 42 | for use with the N Preview, leaving your primary Android Studio environment |
| 43 | unaffected.</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 44 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 45 | <p>To download Android Studio 2.1 as a separate installation, follow these |
| 46 | steps (or if you want to receive Android Studio 2.1 as an update to your |
| 47 | existing installation, skip to step 4):</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 48 | |
| 49 | <ol> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 50 | <li>Edit the name of your |
| 51 | existing Android Studio installation and append the version number. This way, |
| 52 | when you install the new version, it will not override the existing one.</li> |
| 53 | <li>Download the appropriate ZIP file for your operating system from the |
| 54 | <a href="http://tools.android.com/download/studio/canary/latest" |
| 55 | >canary channel download page</a>. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 56 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 57 | <li>Unzip the package and move the Android Studio 2.1 contents to the |
| 58 | appropriate location for applications on your system, then launch it.</li> |
| 59 | <li>Open the Settings dialog |
| 60 | (<strong>File > Settings</strong> on Windows/Linux, or |
| 61 | <strong>Android Studio > Preferences</strong> on Mac). In the left |
| 62 | panel, select <strong>Appearance & Behavior > System Settings > |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 63 | Updates</strong>. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 64 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 65 | <li>On the Updates panel, select the <strong>Automatically |
| 66 | check updates for</strong> check box and select |
| 67 | <strong>Canary Channel</strong> from the drop-down list. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 68 | </li> |
| 69 | </ol> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 70 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 71 | <p>Keep this settings window open for the next step.</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 72 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 73 | |
| 74 | <h2 id="get-sdk">Get the N Preview SDK</h2> |
| 75 | |
| 76 | <p>Now add the N Preview SDK to your Android Studio 2.1 development |
| 77 | environment as follows:</p> |
| 78 | |
| 79 | <ol> |
| 80 | <li>While still viewing the Updates panel from the previous |
| 81 | procedure, select the <strong>Automatically |
| 82 | check updates for Android SDK</strong> check box and select |
| 83 | <strong>Preview Channel</strong> from the drop-down list. |
| 84 | </li> |
| 85 | <li>Click <strong>Check Now</strong>.</li> |
| 86 | |
| 87 | <li>In the left panel, select <strong>Appearance & Behavior > |
| 88 | System Settings > Android SDK</strong>. |
| 89 | |
| 90 | <li>Click the <strong>SDK Platforms</strong> tab, then select the |
| 91 | <strong>Android N Preview</strong> check box.</li> |
| 92 | |
| 93 | <li>Click the <strong>SDK Tools</strong> tab, then select the |
| 94 | <strong>Android SDK Build Tools</strong>, <strong>Android SDK |
| 95 | Platform-Tools</strong>, and <strong>Android SDK Tools</strong> check |
| 96 | boxes. |
| 97 | </li> |
| 98 | |
| 99 | <li>Click <strong>OK</strong>, then accept the licensing |
| 100 | agreements for any packages that need to be installed. |
| 101 | </li> |
| 102 | </ol> |
| 103 | |
| 104 | <p>In addition to these preview components, you should download the |
| 105 | N Preview developer docs from the following table. This is an offline version |
| 106 | of the developer.android.com web site, except it includes the updated |
| 107 | API reference for the N Preview APIs and an API difference report.</p> |
| 108 | |
| 109 | <table id="docs-dl"> |
| 110 | <tr> |
| 111 | <th scope="col">Documentation</th> |
| 112 | <th scope="col">Checksums</th> |
| 113 | </tr> |
| 114 | <tr> |
| 115 | <td style="white-space: nowrap"> |
| 116 | <a href="https://storage.googleapis.com/androiddevelopers/n-preview/n-preview-1-docs.zip" |
| 117 | >n-preview-1-docs.zip</a></td> |
| 118 | <td width="100%"> |
| 119 | MD5: xxxx<br> |
| 120 | SHA-1: xxxx |
| 121 | </td> |
| 122 | </tr> |
| 123 | <table> |
| 124 | |
| 125 | |
| 126 | |
| 127 | <h2 id="java8">Get the Java 8 JDK and JRE</h2> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 128 | |
| 129 | <p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 130 | The Java 8 Development Kit (JDK) is required to develop apps with the Android |
| 131 | N Preview, and the Java 8 Runtime Environment (JRE) is required to run some |
| 132 | tools included in Android Studio 2.1. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 133 | </p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 134 | <p>So, if you don't have the latest version of each already, |
| 135 | <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">download JDK 8</a> and |
| 136 | <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html">download JRE 8</a> now.</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 137 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 138 | <p>With Java 8 installed, set the JDK version in Android Studio as follows:</p> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 139 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 140 | <ol> |
| 141 | <li>Open an Android project in Android Studio, then open the |
| 142 | Project Structure dialog by selecting <strong>File > |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 143 | Project Structure</strong>. |
| 144 | </li> |
| 145 | <li>In the left panel of the dialog, click <strong>SDK Location</strong>. |
| 146 | </li> |
| 147 | <li>In the <strong>JDK Location</strong> field, enter the location of the |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 148 | Java 8 JDK, then click <strong>OK</strong>. |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 149 | </li> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 150 | </ol> |
| 151 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 152 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 153 | <h2 id="create-update">Update or Create a Project</h2> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 154 | |
| 155 | <p> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 156 | To use the N Preview APIs, your project must be configured appropriately. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 157 | </p> |
| 158 | |
| 159 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 160 | <h3 id="update">Update an existing project</h3> |
| 161 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 162 | <p>Open the |
| 163 | <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] | 164 | follows: |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 165 | </p> |
| 166 | |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 167 | <pre> |
| 168 | android { |
| 169 | compileSdkVersion <strong>'android-N'</strong> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 170 | buildToolsVersion <strong>24.0.0</strong> |
Joe Fernandez | 7f94b7e | 2016-03-02 21:30:31 -0800 | [diff] [blame] | 171 | ... |
| 172 | |
| 173 | defaultConfig { |
| 174 | ... |
| 175 | minSdkVersion <strong>'N'</strong> |
| 176 | targetSdkVersion <strong>'N'</strong> |
| 177 | ... |
| 178 | } |
| 179 | ... |
| 180 | }</pre> |
| 181 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 182 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 183 | <h3 id="create">Create a new project</h3> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 184 | |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 185 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 186 | <p>To create a new project for development with the N Preview SDK:</p> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 187 | |
| 188 | <ol> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 189 | <li>Click <strong>File > New Project</strong>. and follow the steps until |
| 190 | you reach the Target Android Devices page. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 191 | </li> |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 192 | <li>On this page, select <strong>Phone and Tablet</strong> option.</li> |
| 193 | <li>Under <strong>Phone and Tablet</strong> option, in the <strong>Minimum |
| 194 | SDK</strong> option list, select |
| 195 | <strong>N: Android API 23, N Preview (Preview)</strong>.</li> |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 196 | </ol> |
| 197 | |
smain@google.com | 0a03f31 | 2016-03-07 16:38:37 -0800 | [diff] [blame] | 198 | |
| 199 | <h2 id="next">Next Steps</h2> |
| 200 | |
| 201 | <p>Now that you've set up Android Studio 2.1 (preview), follow the guide |
| 202 | to <a |
| 203 | href="{@docRoot}preview/run-app.html">Run Your App on the N Preview</a>. |
| 204 | And learn more about the Android N Preview platform with |
| 205 | <a href="{@docRoot}preview/behavior-changes.html">Behavior Changes</a> |
| 206 | and <a href="{@docRoot}preview/api-overview.html">Android N APIs |
| 207 | and Features</a>.</p> |
| 208 | |