1 page.title=Thit lp Preview 2 meta.keywords="preview", "android" 3 page.tags="preview", "developer preview" 4 page.image=images/cards/card-n-sdk_2x.png 5 6 @jd:body 7 8 9 <div id="qv-wrapper"> 10 <div id="qv"> 11 <ol> 12 <li><a href="#get-as13">Ti Android Studio 2.1</a></li> 13 <li><a href="#get-sdk">Ti SDK Android N</a> 14 <ol> 15 <li><a href="#docs-dl">Ti liu tham kho</a> 16 </ol> 17 </li> 18 <li><a href="#java8">Ti JDK v JRE ca Java 8</a></li> 19 <li><a href="#create-update">Cp nht hoc To mt d n</a></li> 20 <li><a href="#next">Cc bc tip theo</a></li> 21 </ol> 22 </div> 23 </div> 24 25 <p> pht trin cc ng dng cho Android N Preview bn cn thc hin mt s cp nht 26 i vi mi trng pht trin ca mnh nh m t trn trang ny.</p> 27 28 <p> n thun th kh nng tng thch ca ng dng trn 29 nh h thng Android N, hy lm theo hng dn <a href="{@docRoot}preview/download.html">Kim th trn mt Thit b Android N</a>.</p> 30 31 <img src="{@docRoot}preview/images/n-preview-setup.png" width="700" alt="" /> 32 33 34 <h2 id="get-as13">Ti Android Studio 2.1 (bn xem trc)</h2> 35 36 <p>Nn tng Android N b sung h tr cho <a href="{@docRoot}preview/j8-jack.html">cc tnh nng ca ngn ng Java 8</a>, 37 yu cu phi c mt trnh bin dch mi c tn l Jack. Phin bn Jack mi nht 38 hin ch c h tr trong Android Studio 2.1. Do , nu bn mun 39 s dng cc tnh nng ca ngn ng Java 8 th bn cn s dng Android Studio 2.1 40 dng ng dng. Nu khng, bn khng cn s dng trnh bin dch Jack nhng bn 41 vn cn cp nht ln JDK 8 bin dch cho nn tng Android N, 42 nh m t di y. 43 </p> 44 45 <p>Android Studio 2.1 hin ang c di dng bn xem trc trong knh 46 pht hnh Canary. Nu bn 47 c Android Studio v khng mun cp nht ln knh canary th bn c th 48 ti xung Android Studio 2.1 di dng bn ci t ring v s dng 49 pht trin vi Android N khng lm nh hng n mi trng Android Studio 50 chnh ca bn.</p> 51 52 <p> ti xung Android Studio 2.1 di dng bn ci t ring, hy thc hin 53 cc bc sau (hoc nu bn mun nhn Android Studio 2.1 di dng bn cp nht cho 54 bn ci t c sn th hy chuyn n bc 4):</p> 55 56 <ol> 57 <li>Chnh sa tn ca 58 bn ci t Android Studio c sn v thm s phin bn. Lm nh vy 59 khi bn ci t, phin bn mi s khng ghi ln phin bn c sn.</li> 60 <li>Ti xung tp ZIP ph hp cho h iu hnh ca bn t 61 <a href="http://tools.android.com/download/studio/canary/latest">trang ti xung ca knh canary</a>. 62 </li> 63 <li>Gii nn gi v chuyn cc thnh phn ca Android Studio 2.1 ti 64 v tr ph hp cho cc ng dng ca bn trn h thng ri khi chy n.</li> 65 <li>M hp thoi Settings 66 (<strong>File > Settings</strong> trn Windows/Linux, hoc 67 <strong>Android Studio > Preferences</strong> trn Mac). Trong khung 68 bn tri, chn<strong>Appearance & Behavior > System Settings > 69 Updates</strong>. 70 </li> 71 <li>Trn khung Updates, chn hp kim <strong>Automatically 72 check updates for</strong> v chn 73 <strong>Canary Channel</strong> t danh sch th xung. 74 </li> 75 </ol> 76 77 <p>Hy ca s ci t ny m cho bc tip theo.</p> 78 79 80 <h2 id="get-sdk">Ti N Preview SDK</h2> 81 82 <p> bt u pht trin vi cc API Android N, bn cn ci t 83 Android N Preview SDK trong Android Studio nh sau:</p> 84 85 <ol> 86 <li>Vn ti khung Updates (bc 4 bn trn), 87 hy chn hp kim <strong>Automatically 88 check updates for Android SDK</strong> v chn 89 <strong>Preview Channel</strong> t danh sch th xung. 90 </li> 91 <li>Nhp vo <strong>Check Now</strong>.</li> 92 93 <li>Trong khung bn tri, chn <strong>Appearance & Behavior > 94 System Settings > Android SDK</strong>. 95 96 <li>Nhp vo tab <strong>SDK Platforms</strong>, ri chn hp kim 97 <strong>Android N Preview</strong>.</li> 98 99 <li>Nhp vo tab <strong>SDK Tools</strong>, ri chn 100 <strong>Android SDK Build Tools</strong>, <strong>Android SDK 101 Platform-Tools</strong>, v cc hp kim <strong>Android SDK Tools</strong> 102 . 103 </li> 104 105 <li>Nhp vo <strong>OK</strong>, sau ng vi cc tha thun 106 cp php cho cc gi cn c ci t. 107 </li> 108 </ol> 109 110 <h3 id="docs-dl">Ti ti liu tham kho cho N Preview</h3> 111 112 <p> 113 Thng tin chi tit v cc API Android N c trong ti liu tham kho ca 114 Bn xem trc N m bn c th ti xung t bng sau. 115 Gi ny c mt bn ngoi tuyn c rt gn ca trang web 116 cho nh pht trin Android v c mt bn tham kho API c cp nht cho API Android N, mt 117 bo co v s khc bit API. 118 </p> 119 120 <table> 121 <tr> 122 <th scope="col">Ti liu</th> 123 <th scope="col">Tng kim</th> 124 </tr> 125 <tr> 126 <td style="white-space: nowrap"> 127 <a href="{@docRoot}shareables/preview/n-preview-1-docs.zip">n-preview-1-docs.zip</a></td> 128 <td width="100%"> 129 MD5: 4ab33ccbe698f46f125cc5b807cf9c2f<br> 130 SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5 131 </td> 132 </tr> 133 </table> 134 135 136 137 <h2 id="java8">Ti JDK v JRE ca Java 8</h2> 138 139 <p> bin dch ng dng ca bn cho nn tng Android N, bn cn s dng 140 B cng c pht trin Java 8 (JDK 8) v s dng mt s cng c vi Android 141 Studio 2.1 th bn cn ci t Java 8 Runtime Environment (JRE). V vy, nu 142 bn khng c phin bn mi nht ca mi b th hy ti xung JDK 8 v JRE 8 143 ngay.</p> 144 145 <p>Sau t phin bn JDK trong Android Studio nh sau:</p> 146 147 <ol> 148 <li>M mt d n Android trong Android Studio, sau m 149 hp thoi Project Structure bng cch chn <strong>File > 150 Project Structure</strong>. (Bng cch khc, bn c th t mc nh 151 cho mi d n bng cch chn <strong>File > Other Settings > 152 Default Project Structure</strong>.) 153 </li> 154 <li>Trong khung bn tri ca hp thoi, hy nhp <strong>SDK Location</strong>. 155 </li> 156 <li>Trong <strong>JDK Location</strong>, hy nhp v tr ca 157 Java 8 JDK (nhp vo nt bn phi 158 duyt tm tp ca bn), sau nhp <strong>OK</strong>. 159 </li> 160 </ol> 161 162 <img src="{@docRoot}preview/images/studio-jdk-location.jpg" width="700" alt="" /> 163 164 165 <h2 id="create-update">Cp nht hoc To mt d n</h2> 166 167 <p> 168 D n ca bn phi c cu hnh ph hp s dng cc API Android N. 169 </p> 170 171 <p>Nu bn d nh s dng cc tnh nng ca ngn ng Java 8 th bn cng nn c mc 172 <a href="{@docRoot}preview/j8-jack.html">Cc tnh nng ca Ngn ng Java 8</a> 173 bit thm thng tin v cc tnh nng ca Java 8 c h tr v 174 cch cu hnh d n vi trnh bin dch Jack.</p> 175 176 177 <h3 id="update">Cp nht mt d n c sn</h3> 178 179 <p>M tp 180 <code>build.gradle</code> cho m-un ca bn v cp nht cc gi tr nh 181 sau: 182 </p> 183 184 <pre> 185 android { 186 compileSdkVersion <strong>'android-N'</strong> 187 buildToolsVersion <strong>'24.0.0-rc1'</strong> 188 ... 189 190 defaultConfig { 191 minSdkVersion <strong>'N'</strong> 192 targetSdkVersion <strong>'N'</strong> 193 ... 194 } 195 ... 196 }</pre> 197 198 199 <h3 id="create">To mt d n mi</h3> 200 201 202 <p> to mt d n mi pht trin vi Android N Preview SDK:</p> 203 204 <ol> 205 <li>Nhp vo <strong>File > New Project</strong>. v thc hin theo cc bc n khi 206 bn n trang Target Android Devices. 207 </li> 208 <li>Trong trang ny, hy chn ty chn <strong>Phone and Tablet</strong>.</li> 209 <li>Di ty chn <strong>Phone and Tablet</strong>, trong danh sch ty chn <strong>Minimum 210 SDK</strong> hy chn 211 <strong>N: Android API 23, N Preview (Preview)</strong>.</li> 212 </ol> 213 214 215 <h2 id="next">Cc bc tip theo</h2> 216 217 <ul> 218 <li>Lm theo hng dn <a href="{@docRoot}preview/download.html">Kim th trn mt Thit b Android N</a>.</li> 219 <li>Tm hiu thm v nn tng Android N vi 220 <a href="{@docRoot}preview/behavior-changes.html">Cc thay i Hnh vi</a> 221 v<a href="{@docRoot}preview/api-overview.html">API Android N 222 v Cc tnh nng</a>.</li> 223 </ul> 224