1 ndk=true 2 page.template=sdk 3 4 ndk.mac64.legacy_download=android-ndk-r9b-darwin-x86_64-legacy-toolchains.tar.bz2 5 ndk.mac64.legacy_bytes=122378495 6 ndk.mac64.legacy_checksum=19c696a5b690b040409c68b21e9fcf46 7 8 ndk.mac64_download=android-ndk-r9b-darwin-x86_64.tar.bz2 9 ndk.mac64_bytes=354748937 10 ndk.mac64_checksum=710d80b6ff807f03e585f9aacee3bf09 11 12 13 ndk.mac32.legacy_download=android-ndk-r9b-darwin-x86-legacy-toolchains.tar.bz2 14 ndk.mac32.legacy_bytes=119394536 15 ndk.mac32.legacy_checksum=be0a07bcea3695f7d93cbd1b880d3f75 16 17 ndk.mac32_download=android-ndk-r9b-darwin-x86.tar.bz2 18 ndk.mac32_bytes=349307548 19 ndk.mac32_checksum=b5fa7aa3b9fca5a5b0c46bdd970d284b 20 21 22 ndk.linux64.legacy_download=android-ndk-r9b-linux-x86_64-legacy-toolchains.tar.bz2 23 ndk.linux64.legacy_bytes=127742633 24 ndk.linux64.legacy_checksum=f41017d5888a8dc210d1703dcdf1def7 25 26 ndk.linux64_download=android-ndk-r9b-linux-x86_64.tar.bz2 27 ndk.linux64_bytes=366988131 28 ndk.linux64_checksum=56c0999a2683d6711591843217f943e0 29 30 31 ndk.linux32.legacy_download=android-ndk-r9b-linux-x86-legacy-toolchains.tar.bz2 32 ndk.linux32.legacy_bytes=125676842 33 ndk.linux32.legacy_checksum=bfc7a1e6baf856b4348d57abffc761d2 34 35 ndk.linux32_download=android-ndk-r9b-linux-x86.tar.bz2 36 ndk.linux32_bytes=361394055 37 ndk.linux32_checksum=d7f783deaeea6b60cb515d9427c01c2e 38 39 40 ndk.win64.legacy_download=android-ndk-r9b-windows-x86_64-legacy-toolchains.zip 41 ndk.win64.legacy_bytes=166961852 42 ndk.win64.legacy_checksum=6eee9459986e8b7f1032d62831dd775b 43 44 ndk.win64_download=android-ndk-r9b-windows-x86_64.zip 45 ndk.win64_bytes=479012553 46 ndk.win64_checksum=1ba6be7ebf4e9272d77031dd70f81e94 47 48 49 ndk.win32.legacy_download=android-ndk-r9b-windows-x86-legacy-toolchains.zip 50 ndk.win32.legacy_bytes=152568224 51 ndk.win32.legacy_checksum=00c8373b53ad9475f1bab1de4219b877 52 53 ndk.win32_download=android-ndk-r9b-windows-x86.zip 54 ndk.win32_bytes=455928388 55 ndk.win32_checksum=cfb9402ea08a1554186e85ed28cb4593 56 57 58 page.title=Android NDK 59 @jd:body 60 61 62 63 64 <div id="tos" style="display:none;width:760px;height:0;margin:0 auto"> 65 66 <div id="download" class="ndk" style=" 67 z-index: 99; 68 width: 720px; 69 position: absolute; 70 margin: -70px 0; 71 padding: 14px; 72 background: white; 73 border: 1px solid #999; 74 box-shadow: -10px 10px 50px #888; 75 -moz-box-shadow: -10px 10px 50px #888; 76 -webkit-box-shadow: -10px 10px 50px #888;"> 77 <p>Before installing the Android NDK, you must agree to the following terms and conditions.</p> 78 <div class="sdk-terms" style="width:auto" onfocus="this.blur()"> 79 <h2 class="norule">Terms and Conditions</h2> 80 This is the Android Software Development Kit License Agreement 81 82 <h3>1. Introduction</h3> 83 1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK. 84 85 1.2 Android means the Android software stack for devices, as made available under the Android Open Source Project, which is located at the following URL: http://source.android.com/, as updated from time to time. 86 87 1.3 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States. 88 89 90 <h3>2. Accepting this License Agreement</h3> 91 2.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the SDK if you do not accept this License Agreement. 92 93 2.2 By clicking to accept, you hereby agree to the terms of this License Agreement. 94 95 2.3 You may not use the SDK and may not accept the License Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries including the country in which you are resident or from which you use the SDK. 96 97 2.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to this License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the SDK on behalf of your employer or other entity. 98 99 100 <h3>3. SDK License from Google</h3> 101 3.1 Subject to the terms of this License Agreement, Google grants you a limited, worldwide, royalty-free, non-assignable and non-exclusive license to use the SDK solely to develop applications to run on the Android platform. 102 103 3.2 You agree that Google or third parties own all legal right, title and interest in and to the SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Google reserves all rights not expressly granted to you. 104 105 3.3 You may not use the SDK for any purpose not expressly permitted by this License Agreement. Except to the extent required by applicable third party licenses, you may not: (a) copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK; or (b) load any part of the SDK onto a mobile handset or any other hardware device except a personal computer, combine any part of the SDK with other software, or distribute any software or device incorporating a part of the SDK. 106 107 3.4 You agree that you will not take any actions that may cause or result in the fragmentation of Android, including but not limited to distributing, participating in the creation of, or promoting in any way a software development kit derived from the SDK. 108 109 3.5 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not this License Agreement. 110 111 3.6 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Google's sole discretion, without prior notice to you. 112 113 3.7 Nothing in this License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features. 114 115 3.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK. 116 117 118 <h3>4. Use of the SDK by You</h3> 119 4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under this License Agreement in or to any software applications that you develop using the SDK, including any intellectual property rights that subsist in those applications. 120 121 4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) this License Agreement and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries). 122 123 4.3 You agree that if you use the SDK to develop applications for general public users, you will protect the privacy and legal rights of those users. If the users provide you with user names, passwords, or other login information or personal information, you must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If the user provides your application with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, the user has given you permission to do so. 124 125 4.4 You agree that you will not engage in any activity with the SDK, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of any third party including, but not limited to, Google or any mobile communications carrier. 126 127 4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through Android and/or applications for Android, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so. 128 129 4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under this License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach. 130 131 132 <h3>5. Your Developer Credentials</h3> 133 5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials. 134 135 136 <h3>6. Privacy and Information</h3> 137 6.1 In order to continually innovate and improve the SDK, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected. 138 139 6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Google's Privacy Policy. 140 141 142 <h3>7. Third Party Applications</h3> 143 7.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources. 144 145 7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners. 146 147 7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, this License Agreement does not affect your legal relationship with these third parties. 148 149 150 <h3>8. Using Android APIs</h3> 151 8.1 Google Data APIs 152 153 8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by Google or those parties that provide the data (or by other persons or companies on their behalf). Your use of any such API may be subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless allowed by the relevant Terms of Service. 154 155 8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so. 156 157 158 <h3>9. Terminating this License Agreement</h3> 159 9.1 This License Agreement will continue to apply until terminated by either you or Google as set out below. 160 161 9.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials. 162 163 9.3 Google may at any time, terminate this License Agreement with you if: 164 (A) you have breached any provision of this License Agreement; or 165 (B) Google is required to do so by law; or 166 (C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated its relationship with Google or ceased to offer certain parts of the SDK to you; or 167 (D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country in which you are resident or from which you use the service, or the provision of the SDK or certain SDK services to you by Google is, in Google's sole discretion, no longer commercially viable. 168 169 9.4 When this License Agreement comes to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst this License Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall continue to apply to such rights, obligations and liabilities indefinitely. 170 171 172 <h3>10. DISCLAIMER OF WARRANTIES</h3> 173 10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE. 174 175 10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. 176 177 10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 178 179 180 <h3>11. LIMITATION OF LIABILITY</h3> 181 11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. 182 183 184 <h3>12. Indemnification</h3> 185 12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you with this License Agreement. 186 187 188 <h3>13. Changes to the License Agreement</h3> 189 13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Google will make a new version of the License Agreement available on the website where the SDK is made available. 190 191 192 <h3>14. General Legal Terms</h3> 193 14.1 This License Agreement constitutes the whole legal agreement between you and Google and governs your use of the SDK (excluding any services which Google may provide to you under a separate written agreement), and completely replaces any prior agreements between you and Google in relation to the SDK. 194 195 14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in this License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google. 196 197 14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of this License Agreement is invalid, then that provision will be removed from this License Agreement without affecting the rest of this License Agreement. The remaining provisions of this License Agreement will continue to be valid and enforceable. 198 199 14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to this License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of this License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to this License Agreement. 200 201 14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. 202 203 14.6 The rights granted in this License Agreement may not be assigned or transferred by either you or Google without the prior written approval of the other party. Neither you nor Google shall be permitted to delegate their responsibilities or obligations under this License Agreement without the prior written approval of the other party. 204 205 14.7 This License Agreement, and your relationship with Google under this License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from this License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction. 206 207 208 <em>November 13, 2012</em> 209 </div> 210 211 212 213 <div id="sdk-terms-form"> 214 <p> 215 <input id="agree" type="checkbox" name="agree" value="1" onclick="onAgreeChecked()" /> 216 <label id="agreeLabel" for="agree">I have read and agree with the above terms and conditions</label> 217 </p> 218 <p><a href="" class="button disabled ndk" id="downloadForRealz" onclick="return onDownloadNdkForRealz(this);"></a></p> 219 </div> 220 221 222 223 </div> 224 </div> 225 226 227 228 229 230 231 232 233 234 235 <div id="qv-wrapper"> 236 <div id="qv"> 237 <h2>In this document</h2> 238 239 <ol> 240 <li><a href="#Downloads">Downloads</a></li> 241 <li><a href="#Revisions">Revisions</a></li> 242 <li><a href="#Reqs">System and Software Requirements</a></li> 243 <li><a href="#Installing">Installing the NDK</a></li> 244 <li><a href="#GetStarted">Getting Started with the NDK</a> 245 <ol> 246 <li><a href="#Using">Using the NDK</a></li> 247 </ol> 248 </li> 249 <li><a href="#Contents">Contents of the NDK</a> 250 <ol> 251 <li><a href="#Tools">Development tools</a></li> 252 <li><a href="#Docs">Documentation</a></li> 253 <li><a href="#Samples">Sample apps</a></li> 254 </ol> 255 </li> 256 </ol> 257 </div> 258 </div> 259 260 <p>The NDK is a toolset that allows you to implement parts 261 of your app using native-code languages such as C and C++. For certain types of apps, 262 this can be helpful so you can reuse existing code libraries written in these 263 languages, but most apps do not need the Android NDK.</p> 264 265 <p>Before downloading the NDK, you should understand that <strong>the NDK 266 will not benefit most apps</strong>. As a developer, you need to balance its benefits 267 against its drawbacks. Notably, using native code on Android 268 generally does not result in a noticable performance improvement, 269 but it always increases your app complexity. In general, you should only use the NDK 270 if it is essential to your app—never because you simply prefer to program in C/C++.</p> 271 272 <p>Typical good candidates for the NDK are self-contained, CPU-intensive operations that don't 273 allocate much memory, such as signal processing, physics simulation, and so on. When examining 274 whether or not you should develop in native code, think about your requirements and see if the 275 Android framework APIs provide the functionality that you need.</p> 276 277 278 <h2 id="Downloads">Downloads</h2> 279 280 281 <script> 282 $('#Downloads').after($('#download-table')); 283 </script> 284 285 286 <p>With NDK revision 9 and higher, the release packages have been split to reduce download size. 287 The first download for each platform contains the default NDK toolchain. The second download 288 contains legacy NDK toolchains for that platform, which is only required if you are not using 289 the current, recommended toolchain for your NDK builds.</p> 290 291 292 293 <h2 id="Revisions">Revisions</h2> 294 295 <p>The following sections provide information about releases of the NDK.</p> 296 297 <div class="toggle-content opened"> 298 <p> 299 <a href="#" onclick="return toggleContent(this)"> <img 300 src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" alt="" 301 >Android NDK, Revision 9b</a> <em>(October 2013)</em> 302 </p> 303 <div class="toggle-content-toggleme"> 304 <dl> 305 <dt>Important changes:</dt> 306 <dd> 307 <ul> 308 <li>Updated {@code include/android/*h} and {@code math.h} for all Android API levels up to 309 18, including the addition of levels 13, 15, 16 and 17. 310 For information on added APIs, see commit messages for Changes 311 <a href="https://android-review.googlesource.com/68012">68012</a> and 312 <a href="https://android-review.googlesource.com/68014">68014</a>. 313 (Issues <a href="http://b.android.com/47150">47150</a>, 314 <a href="http://b.android.com/58528">58528</a>, and 315 <a href="http://b.android.com/38423">38423</a>)</li> 316 <li>Added support for API level 19, including Renderscript binding.</li> 317 <li>Added support for <code>-mhard-float</code> in the existing armeabi-v7a ABI. For more 318 information and current restrictions on Clang, see 319 {@code tests/device/hard-float/jni/Android.mk}.</li> 320 <li>Migrated from GNU Compiler Collection (GCC) 4.8 to 4.8.2, and added diagnostic color 321 support. To enable diagnostic colors, set <code>-fdiagnostics-color=auto</code>, 322 <code>-fdiagnostics-color=always,</code> or export {@code GCC_COLORS} as shown below: 323 <pre> 324 GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 325 </pre> 326 For more information, see 327 <a href="http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html">GCC 328 Language Independent Options</a>. 329 </li> 330 <li>Added two new samples to demonstrate OpenGL ES 3.0 features: Teapot and MoreTeapots. 331 These samples run on devices with Android 4.1 (API level 16) and higher.</li> 332 <li>Deprecated GCC 4.7 and Clang 3.2 support, which will be removed in the next 333 release.</li> 334 </ul> 335 </dd> 336 337 <dt>Important bug fixes:</dt> 338 <dd> 339 <ul> 340 <li>Fixed problem with ARM GCC 4.6 {@code thumb2} failing to generate 16-bit relative jump 341 tables. (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48328">GCC Issue</a>)</li> 342 <li>Fixed GCC 4.8 internal compiler error (ICE) on 343 {@code g++.dg/cpp0x/lambda/lambda-defarg3.C}. 344 (<a href="https://android-review.googlesource.com/62770">Change 62770</a>, 345 <a href="http://gcc.gnu.org/ml/gcc/2013-07/msg00424.html">GCC Issue</a>)</li> 346 <li>Fixed a problem with Windows 32-bit {@code *-gdb.exe} executables failing to launch. 347 (<a href="http://b.android.com/58975">Issue 58975</a>)</li> 348 <li>Fixed GCC 4.8 ICE when building bullet library. The error message is as follows: 349 <pre>internal compiler error: verify_flow_info failed</pre> 350 (<a href="http://b.android.com/58916">Issue 58916</a>, 351 <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58165">GCC Issue</a>)</li> 352 <li>Modified GDB/ARM build to skip {@code ARM.exidx} data for unwinding in prologue code and 353 added a command ({@code set arm exidx-unwinding}) to control exidx-based stack unwinding. 354 (<a href="http://b.android.com/55826">Issue 55826</a>)</li> 355 <li>Fixed Clang 3.3 MIPS compiler problem where HI and LO registers are incorrectly 356 reused.</li> 357 <li>Fixed issue with MIPS 4.7 ICE in {@code dbx_reg_number}. The error message is as follows: 358 <pre> 359 external/icu4c/i18n/decimfmt.cpp:1322:1: 360 internal compiler error: in dbx_reg_number, at dwarf2out.c:10185 361 </pre> 362 (<a href="http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00830.html">GCC Patch</a>) 363 364 </li> 365 366 </ul> 367 </dd> 368 369 <dt>Other bug fixes:</dt> 370 <dd> 371 <ul> 372 <li>Header fixes 373 <ul> 374 <li>Fixed the ARM {@code WCHAR_MIN} and {@code WCHAR_MAX} to be unsigned according to 375 spec (the X86/MIPS versions are signed). Define {@code _WCHAR_IS_ALWAYS_SIGNED} to 376 restore old behavior. (<a href="http://b.android.com/57749">Issue 57749</a>)</li> 377 <li>Fixed {@code include/netinet/tcp.h} to contain {@code TCP_INFO} state enum. 378 (<a href="http://b.android.com/38881">Issue 38881</a>)</li> 379 <li>Fixed the {@code cdefs_elh.h} macro {@code _C_LABEL_STRING} to stop generating 380 warnings in the GCC 4.8 toolchain when using c++11 mode. 381 (<a href="http://b.android.com/58135">Issue 58135</a>, 382 <a href="http://b.android.com/58652">Issue 58652</a>)</li> 383 <li>Removed non-existent functions {@code imaxabs} and {@code imaxdiv} from header 384 {@code inttypes.h}.</li> 385 <li>Fixed issue with {@code pthread_exit()} return values and {@code pthread_self()}. 386 (<a href="http://b.android.com/60686">Issue 60686</a>)</li> 387 <li>Added missing {@code mkdtemp()} function, which already exists in {@code bionic} 388 header {@code stdlib.h}.</li> 389 </ul> 390 </li> 391 <li>Fixed problem building {@code samples/gles3jni} with Clang on Android API level 11.</li> 392 <li>Fixed MCLinker to allow multiple occurrences of the following options: 393 {@code -gc-sections} and {@code --eh-frame-hdr}.</li> 394 <li>Fixed MCLinker to accept the {@code --no-warn-mismatch} option.</li> 395 <li>Modified {@code cpu-features} option to not assume all VFPv4 devices support IDIV. 396 Now this option only adds IDIV to white-listed devices, including Nexus 4. 397 (<a href="http://b.android.com/57637">Issue 57637</a>)</li> 398 <li>Fixed problem with {@code android_native_app_glue.c} erroneously logging errors on event 399 predispatch operations.</li> 400 <li>Fixed all operations on {@code gabi++} terminate and unexpected_handler to be 401 thread-safe.</li> 402 <li>Fixed several issues with Clang <code>-integrated-as</code> option so it can pass 403 tests for {@code ssax-instructions} and {@code fenv}.</li> 404 <li>Fixed GCC 4.6/4.7/4.8 compiler to pass the linker option {@code --eh-frame-hdr} even 405 for static executables. For more information, see the 406 <a href="http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00969.html">GCC patch</a>.</li> 407 <li>Fixed extra apostrophe in <code>CPU-ARCH-ABIS.html</code>. For more information, see 408 <code>NDK-DEPENDS.html</code>. (<a href="http://b.android.com/60142">Issue 60142</a>)</li> 409 <li>Fixed extra quotes in ndk-build output on Windows. 410 (<a href="http://b.android.com/60649">Issue 60649</a>)</li> 411 <li>Fixed Clang 3.3 to compile ARM's built-in, atomic operations such as 412 {@code __atomic_fetch_add}, {@code __atomic_fetch_sub}, and {@code __atomic_fetch_or}. 413 </li> 414 <li>Fixed Clang 3.3 ICE with customized {@code vfprintf}. 415 (<a href="http://llvm.org/bugs/show_bug.cgi?id=16344">Clang issue</a>) 416 </li> 417 </ul> 418 </dd> 419 420 <dt>Other changes:</dt> 421 <dd> 422 <ul> 423 <li>Enabled OpenMP for all GCC builds. To use this feature, add the following flags to your 424 build settings: 425 <pre> 426 LOCAL_CFLAGS += -fopenmp 427 LOCAL_LDFLAGS += -fopenmp 428 </pre> 429 For code examples, see {@code tests/device/test-openmp}</li> 430 <li>Reduced the size of {@code ld.mcld} significantly (1.5MB vs. {@code ld.bfd} 3.5MB and 431 {@code ld.gold} 7.5MB), resulting in a speed improvement of approximately 20%.</li> 432 <li>Added <code>LOCAL_CONLYFLAGS</code> and <code>APP_CONLYFLAGS</code> to specify 433 options applicable to C only but not C++. The existing <code>LOCAL_CFLAGS</code> 434 and <code>APP_CFLAGS</code> are also used for C++ compilation (to save trouble of 435 specifying most options twice), so options such as <code>-std=gnu99</code> may fail in 436 g++ builds with a warning and clang++ builds with an error.</li> 437 <li>Added {@code gabi++} array helper functions.</li> 438 <li>Modified GCC builds so that all {@code libgcc.a} files are built with 439 <code>-funwind-tables</code> to allow the stack to be unwound past previously blocked 440 points, such as <code>__aeabi_idiv0</code>.</li> 441 <li>Added Ingenic MXU support in MIPS GCC4.6/4.7/4.8 with new <code>-mmxu</code> option.</li> 442 <li>Extended MIPS GCC4.6/4.7/4.8 <code>-mldc1-sdc1</code> to control ldxc1/sdxc1 too</li> 443 <li>Added crazy linker. For more information, see 444 {@code sources/android/crazy_linker/README.TXT}.</li> 445 <li>Fixed {@code bitmap-plasma} to draw to full screen rather than a 200x200 pixel area.</li> 446 <li>Reduced linux and darwin toolchain sizes by 25% by creating symlinks to identical files. 447 </li> 448 </ul> 449 </dd> 450 451 </dl> 452 </div> 453 </div> 454 455 456 <div class="toggle-content closed"> 457 <p> 458 <a href="#" onclick="return toggleContent(this)"> <img 459 src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt="" 460 >Android NDK, Revision 9</a> <em>(July 2013)</em> 461 </p> 462 <div class="toggle-content-toggleme"> 463 <dl> 464 <dt>Important changes:</dt> 465 <dd> 466 <ul> 467 <li>Added support for Android 4.3 (API level 18). For more information, see 468 {@code STABLE-APIS.html} and new code examples in {@code samples/gles3jni/README}. 469 <li>Added headers and libraries for OpenGL ES 3.0, which is supported by Android 4.3 470 (API level 18) and higher.</li> 471 <li>Added GNU Compiler Collection (GCC) 4.8 compiler to the NDK. Since GCC 4.6 is still 472 the default, you must explicitly enable this option: 473 <ul> 474 <li>For {@code ndk-build} builds, export {@code NDK_TOOLCHAIN_VERSION=4.8} or 475 add it in {@code Application.mk}.</li> 476 <li>For standalone builds, use the {@code --toolchain=} option in 477 {@code make-standalone-toolchain.sh}, for example:<br> 478 {@code --toolchain=arm-linux-androideabi-4.8}</li> 479 </ul> 480 <p class="note"><strong>Note:</strong> 481 The {@code -Wunused-local-typedefs} option is enabled by {@code -Wall}. Be 482 sure to add {@code __attribute__((unused))} if you use compile-time asserts like 483 {@code sources/cxx-stl/stlport/stlport/stl/config/features.h}, line #311. For more 484 information, see 485 <a href="https://android-review.googlesource.com/#/c/55460">Change 55460</a></p> 486 <p class="note"><strong>Note:</strong> 487 In the GCC 4.7 release and later, ARM compilers generate unaligned access code by 488 default for ARMv6 and higher build targets. You may need to add the 489 {@code -mno-unaligned-access} build option when building for kernels that do not support 490 this feature.</p> 491 </li> 492 <li>Added Clang 3.3 support. The {@code NDK_TOOLCHAIN_VERSION=clang} build option 493 now picks Clang 3.3 by default. 494 <p class="note"><strong>Note:</strong> 495 Both GCC 4.4.3 and Clang 3.1 are deprecated, and will be removed from the next NDK 496 release.</p></li> 497 <li>Updated GNU Project Debugger (GDB) to support python 2.7.5.</li> 498 <li>Added MCLinker to support Windows hosts. Since {@code ld.gold} 499 is the default where available, you must add {@code -fuse-ld=mcld} in 500 {@code LOCAL_LDFLAGS} or {@code APP_LDFLAGS} to enable MCLinker.</li> 501 <li>Added {@code ndk-depends} tool which prints ELF library dependencies. 502 For more information, see {@code NDK-DEPENDS.html}. 503 (<a href="http://b.android.com/53486">Issue 53486</a>)</li> 504 </ul> 505 </dd> 506 507 <dt>Important bug fixes:</dt> 508 <dd> 509 <ul> 510 <li>Fixed potential event handling issue in {@code android_native_app_glue}. 511 (<a href="http://b.android.com/41755">Issue 41755</a>)</li> 512 <li>Fixed ARM/GCC-4.7 build to generate sufficient alignment for NEON load and store 513 instructions VST and VLD. 514 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57271">GCC Issue 57271</a>)</li> 515 <li>Fixed a GCC 4.4.3/4.6/4.7 internal compiler error (ICE) for a constant negative index 516 value on a string literal. 517 (<a href="http://b.android.com/54623">Issue 54623</a>)</li> 518 <li>Fixed GCC 4.7 segmentation fault for constant initialization with an object address. 519 (<a href="http://b.android.com/56508">Issue 56508</a>)</li> 520 <li>Fixed GCC 4.6 ARM segmentation fault for <code>-O</code> values when using Boost 521 1.52.0. (<a href="http://b.android.com/42891">Issue 42891</a>) 522 <li>Fixed {@code libc.so} and {@code libc.a} to support the {@code wait4()} function. 523 (<a href="http://b.android.com/19854">Issue 19854</a>)</li> 524 <li>Updated the x86 libc.so and libc.a files to include the {@code clone()} 525 function.</li> 526 <li>Fixed {@code LOCAL_SHORT_COMMANDS} bug where the {@code linker.list} file is 527 empty or not used.</li> 528 <li>Fixed GCC MIPS build on Mac OS to use CFI directives, without which 529 {@code ld.mcld --eh-frame-hdr} fails frequently.</li> 530 <li>Fixed Clang 3.2 X86/MIPS internal compiler error in {@code llvm/lib/VMCore/Value.cpp}. 531 (<a href="https://android-review.googlesource.com/#/c/59021">Change 59021</a>)</li> 532 <li>Fixed GCC 4.7 64-bit Windows assembler crash. (Error: {@code out of memory allocating 533 4294967280 bytes}).</li> 534 <li>Updated {@code ndk-gdb} script so that the {@code --start} or {@code --launch} actions 535 now wait for the GNU Debug Server, so that it can more reliably hit breakpoints set 536 early in the execution path (such as breakpoints in JNI code). 537 (<a href="http://b.android.com/41278">Issue 41278</a>) 538 <p class="note"><strong>Note:</strong> 539 This feature requires jdb and produces warning about pending breakpoints. 540 Specify the {@code --nowait} option to restore previous behavior. 541 </p> 542 </li> 543 <li>Fixed GDB crash when library list is empty.</li> 544 <li>Fixed GDB crash when using a {@code stepi} command past a {@code bx pc} or 545 {@code blx pc} Thumb instruction. 546 (<a href="http://b.android.com/56962">Issue 56962</a>, 547 <a href="http://b.android.com/36149">Issue 36149</a>)</li> 548 <li>Fixed MIPS {@code gdbserver} to look for {@code DT_MIPS_RLD_MAP} instead of 549 {@code DT_DEBUG}. (<a href="http://b.android.com/56586">Issue 56586</a>)</li> 550 <li>Fixed a circular dependency in the ndk-build script, for example: If A->B and 551 B->B, then B was dropped from build. 552 (<a href="http://b.android.com/56690">Issue 56690</a>)</li> 553 </ul> 554 </dd> 555 556 <dt>Other bug fixes:</dt> 557 <dd> 558 <ul> 559 <li>Fixed the {@code ndk-build} script to enable you to specify a version of Clang as a 560 command line option (e.g., {@code NDK_TOOLCHAIN_VERSION=clang3.2}). Previously, only 561 specifying the version as an environment variable worked.</li> 562 <li>Fixed gabi++ size of {@code _Unwind_Exception} to be 24 for MIPS build targets when 563 using the Clang compiler. 564 (<a href="https://android-review.googlesource.com/#/c/54141">Change 54141</a>)</li> 565 <li>Fixed the {@code ndk-build} script to ensure that built libraries are actually 566 removed from projects that include prebuilt static libraries when using the 567 {@code ndk-build clean} command. 568 (<a href="https://android-review.googlesource.com/#/c/54461">Change 54461</a>, 569 <a href="https://android-review.googlesource.com/#/c/54480">Change 54480</a>)</li> 570 <li>Modified the {@code NDK_ANALYZE=1} option to be less verbose.</li> 571 <li>Fixed {@code gnu-libstdc++/Android.mk} to include a {@code backward/} path for builds 572 that use backward compability. 573 (<a href="http://b.android.com/53404">Issue 53404</a>)</li> 574 <li>Fixed a problem where {@code stlport new} sometimes returned random values.</li> 575 <li>Fixed {@code ndk-gdb} to match the order of {@code CPU_ABIS}, not {@code APP_ABIS}. 576 (<a href="http://b.android.com/54033">Issue 54033</a>)</li> 577 <li>Fixed a problem where the NDK 64-bit build on MacOSX choses the wrong path for 578 compiler. 579 (<a href="http://b.android.com/53769">Issue 53769</a>)</li> 580 <li>Fixed build scripts to detect 64-bit Windows Vista. 581 (<a href="http://b.android.com/54485">Issue 54485</a>)</li> 582 <li>Fixed x86 {@code ntonl/swap32} error: {@code invalid 'asm': operand number 583 out of range}. 584 (<a href="http://b.android.com/54465">Issue 54465</a>, 585 <a href="https://android-review.googlesource.com/#/c/57242">Change 57242</a>)</li> 586 <li>Fixed {@code ld.gold} to merge string literals.</li> 587 <li>Fixed {@code ld.gold} to handle large symbol alignment.</li> 588 <li>Updated {@code ld.gold} to enable the {@code --sort-section=name} option.</li> 589 <li>Fixed GCC 4.4.3/4.6/4.7 to suppress the {@code -export-dynamic} option for 590 statically linked programs. GCC no longer adds an {@code .interp} section for statically 591 linked programs.</li> 592 <li>Fixed GCC 4.4.3 {@code stlport} compilation error about inconsistent {@code typedef} 593 of {@code _Unwind_Control_Block}. 594 (<a href="http://b.android.com/54426">Issue 54426</a>)</li> 595 <li>Fixed {@code awk} scripts to handle {@code AndroidManifest.xml} files created on 596 Windows which may contain trailing {@code \r} characters and cause build errors. 597 (<a href="http://b.android.com/42548">Issue 42548</a>)</li> 598 <li>Fixed {@code make-standalone-toolchain.sh} to probe the {@code prebuilts/} 599 directory to detect if the host is 32 bit or 64 bit.</li> 600 <li>Fixed the Clang 3.2 {@code -integrated-as} option.</li> 601 <li>Fixed the Clang 3.2 ARM EHABI compact model {@code pr1} and {@code pr2} handler data. 602 </li> 603 <li>Added Clang {@code -mllvm -arm-enable-ehabi} option to fix the following Clang error: 604 <pre>clang: for the -arm-enable-ehabi option: may only occur zero or one times!</pre> 605 </li> 606 <li>Fixed build failure when there is no {@code uses-sdk} element in application 607 manifest. (<a href="http://b.android.com/57015">Issue 57015</a>)</li> 608 </ul> 609 610 </dd> 611 <dt>Other changes:</dt> 612 <dd> 613 <ul> 614 <li>Header Fixes 615 <ul> 616 <li>Modified headers to make {@code __set_errno} an inlined function, since 617 {@code __set_errno} in {@code errno.h} is deprecated, and {@code libc.so} no longer 618 exports it.</li> 619 <li>Modified {@code elf.h} to include {@code stdint.h}. 620 (<a href="http://b.android.com/55443">Issue 55443</a>)</li> 621 <li>Fixed {@code sys/un.h} to be included independently of other headers. 622 (<a href="http://b.android.com/53646">Issue 53646</a>)</li> 623 <li>Fixed all of the {@code MotionEvent_getHistorical} API family to take the 624 {@code const AInputEvent* motion_event}. 625 (<a href="http://b.android.com/55873">Issue 55873</a>)</li> 626 <li>Fixed {@code malloc_usable_size} to take {@code const void*}. 627 (<a href="http://b.android.com/55725">Issue 55725</a>)</li> 628 <li>Fixed stdint.h to be more compatible with C99. 629 (<a href="https://android-review.googlesource.com/#/c/46821">Change 46821</a>)</li> 630 <li>Modified {@code wchar.h} to not redefine {@code WCHAR_MAX} and 631 {@code WCHAR_MIN}</li> 632 <li>Fixed {@code <inttypes.h>} declaration for pointer-related {@code PRI} and 633 {@code SCN} macros. (<a href="http://b.android.com/57218">Issue 57218</a>)</li> 634 <li>Changed the {@code sys/cdefs.h} header so that {@code __WCHAR_TYPE__} is 32-bit 635 for API levels less than 9, which means that {@code wchat_t} is 32-bit for all 636 API levels. To restore the previous behavior, define the {@code _WCHAR_IS_8BIT} 637 boolean variable. (<a href="http://b.android.com/57267">Issue 57267</a>)</li> 638 </ul> 639 </li> 640 <li>Added more formatting in NDK {@code docs/} and miscellaneous documentation fixes. 641 </li> 642 <li>Added support for a thin archive technique when building static libraries. 643 (<a href="http://b.android.com/40303">Issue 40303</a>)</li> 644 <li>Updated script {@code make-standalone-toolchain.sh} to support the {@code stlport} 645 library in addition to {@code gnustl}, when you specify the option 646 {@code --stl=stlport}. For more information, see {@code STANDALONE-TOOLCHAIN.html}.</li> 647 <li>Updated the {@code make-standalone-toolchain.sh} script so that the 648 {@code --llvm-version=} option creates the {@code $TOOLCHAIN_PREFIX-clang} and 649 {@code $TOOLCHAIN_PREFIX-clang++} scripts in addition to {@code clang} and 650 {@code clang++}, to avoid using the host's clang and clang++ definitions by accident. 651 </li> 652 <li>Added two flags to re-enable two optimizations in upstream Clang but disabled in 653 NDK for better compatibility with code compiled by GCC: 654 <ul> 655 <li>Added a {@code -fcxx-missing-return-semantics} flag to re-enable <em>missing return 656 semantics</em> in Clang 3.2+. Normally, all paths should terminate with a return 657 statement for a value-returning function. If this is not the case, clang inserts 658 an undefined instruction (or trap in debug mode) at the path without a return 659 statement. If you are sure your code is correct, use this flag to allow the 660 optimizer to take advantage of the undefined behavior. If you are not sure, do not 661 use this flag. The caller may still receive a random incorrect value, but the 662 optimizer will not exploit it and make your code harder to debug.</li> 663 <li>Added a {@code -fglobal-ctor-const-promotion} flag to re-enable 664 promoting global variables with static constructor to be constants. With this flag, 665 the global variable optimization pass of LLVM tries to evaluate the global 666 variables with static constructors and promote them to global constants. Although 667 this optimization is correct, it may cause some incompatability with code compiled 668 by GCC. For example, code may do {@code const_cast} to cast the constant to mutable 669 and modify it. In GCC, the variable is in read-write and the code is run by 670 accident. In Clang, the const variable is in read-only memory and may cause your 671 application to crash.</li> 672 </ul> 673 </li> 674 <li>Added {@code -mldc1-sdc1} to the MIPS GCC and Clang compilers. By default, compilers 675 align 8-byte objects properly and emit the {@code ldc1} and {@code sdc1} instructions 676 to move them around. If your app uses a custom allocator that does not always align 677 with a new object's 8-byte boundary in the same way as the default allocator, your app 678 may crash due to {@code ldc1} and {@code sdc1} operations on unaligned memory. In this 679 case, use the {@code -mno-ldc1-sdc1} flag to workaround the problem.</li> 680 <li>Downgraded the event severity from warning to info if {@code APP_PLATFORM_LEVEL} is 681 larger than {@code APP_MIN_PLATFORM_LEVEL}. The {@code APP_PLATFORM_LEVEL} may be lower 682 than {@code APP_PLATFORM} in {@code jni/Application.mk} because the NDK does not have 683 headers for all levels. In this case, the actual level is shifted downwards. The 684 {@code APP_MIN_PLATFORM_LEVEL} is specified by the {@code android:minSdkVersion} in 685 your application's manifest. 686 (<a href="http://b.android.com/39752">Issue 39752</a>)</li> 687 <li>Added the {@code android_getCpuIdArm()} and {@code android_setCpuArm()} methods to 688 {@code cpu-features.c}. This addition enables easier retrieval of the ARM CPUID 689 information. (<a href="http://b.android.com/53689">Issue 53689</a>)</li> 690 <li>Modified {@code ndk-build} to use GCC 4.7's {@code as/ld} for Clang compiling. 691 <p class="note"><strong>Note:</strong> 692 In GCC 4.7, {@code monotonic_clock} and {@code is_monotonic} have been renamed to 693 {@code steady_clock} and {@code is_steady}, respectively.</p></li> 694 <li>Added the following new warnings to the {@code ndk-build} script: 695 <ul> 696 <li>Added warnings if {@code LOCAL_LDLIBS/LDFLAGS} are used in static library 697 modules.</li> 698 <li>Added a warning if a configuration has no module to build.</li> 699 <li>Added a warning for non-system libraries being used in 700 {@code LOCAL_LDLIBS/LDFLAGS} of a shared library or executable modules.</li> 701 </ul> 702 </li> 703 <li>Updated build scripts, so that if {@code APP_MODULES} is not defined and only static 704 libraries are listed in {@code Android.mk}, the script force-builds all of them. 705 (<a href="http://b.android.com/53502">Issue 53502</a>)</li> 706 <li>Updated {@code ndk-build} to support absolute paths in {@code LOCAL_SRC_FILES}.</li> 707 <li>Removed the {@code *-gdbtui} executables, which are duplicates of the {@code *-gdb} 708 executables with the {@code -tui} option enabled.</li> 709 <li>Updated the build scripts to warn you when the Edison Design Group (EDG) compiler 710 front-end turns {@code _STLP_HAS_INCLUDE_NEXT} back on. 711 (<a href="http://b.android.com/53646">Issue 53646</a>)</li> 712 <li>Added the environment variable {@code NDK_LIBS_OUT} to allow overriding of the 713 path for {@code libraries/gdbserver} from the default {@code $PROJECT/libs}. 714 For more information, see {@code OVERVIEW.html}.</li> 715 <li>Changed ndk-build script defaults to compile code with format string protection 716 {@code -Wformat -Werror=format-security}. You may set 717 {@code LOCAL_DISABLE_FORMAT_STRING_CHECKS=true} to disable it. 718 For more information, see {@code ANDROID-MK.html}</li> 719 <li>Added STL pretty-print support in {@code ndk-gdb-py}. For more information, see 720 {@code NDK-GDB.html}.</li> 721 <li>Added tests based on the googletest frameworks.</li> 722 <li>Added a notification to the toolchain build script that warns you if the current shell 723 is not {@code bash}.</li> 724 </ul> 725 </dd> 726 </dl> 727 </div> 728 </div> 729 730 731 <div class="toggle-content closed"> 732 <p><a href="#" onclick="return toggleContent(this)"> 733 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 734 alt="">Android NDK, Revision 8e</a> <em>(March 2013)</em> 735 </p> 736 737 <div class="toggle-content-toggleme"> 738 <dl> 739 <dt>Important changes:</dt> 740 <dd> 741 <ul> 742 <li>Added 64-bit host toolchain set (package name suffix {@code *-x86_64.*}). For more 743 information, see {@code CHANGES.HTML} and {@code NDK-BUILD.html}.</li> 744 <li>Added Clang 3.2 compiler. GCC 4.6 is still the default. For information on using the 745 Clang compiler, see {@code CHANGES.HTML}.</li> 746 <li>Added static code analyzer for Linux/MacOSX hosts. For information on using the 747 analyzer, see {@code CHANGES.HTML}.</li> 748 <li>Added MCLinker for Linux/MacOSX hosts as an experimental feature. The {@code ld.gold} 749 linker is the default where available, so you must explicitly enable it. For more 750 information, see {@code CHANGES.HTML}.</li> 751 <li>Updated ndk-build to use topological sort for module dependencies, which means the 752 build automatically sorts out the order of libraries specified in 753 {@code LOCAL_STATIC_LIBRARIES}, {@code LOCAL_WHOLE_STATIC_LIBRARIES} and 754 {@code LOCAL_SHARED_LIBRARIES}. For more information, see {@code CHANGES.HTML}. 755 (<a href="http://b.android.com/39378">Issue 39378</a>)</li> 756 </ul> 757 </dd> 758 759 <dt>Important bug fixes:</dt> 760 <dd> 761 <ul> 762 <li>Fixed build script to build all toolchains in {@code -O2}. Toolchains in previous 763 releases were incorrectly built without optimization.</li> 764 <li>Fixed build script which unconditionally builds Clang/llvm for MacOSX in 64-bit.</li> 765 <li>Fixed GCC 4.6/4.7 internal compiler error: 766 {@code gen_thumb_movhi_clobber at config/arm/arm.md:5832}. 767 (<a href="http://b.android.com/52732">Issue 52732</a>)</li> 768 <li>Fixed build problem where GCC/ARM 4.6/4.7 fails to link code using 64-bit atomic 769 built-in functions. 770 (<a href="http://b.android.com/41297">Issue 41297</a>)</li> 771 <li>Fixed GCC 4.7 linker DIV usage mismatch errors. 772 (<a href="http://sourceware.org/ml/binutils/2012-12/msg00202.html">Sourceware Issue</a>) 773 <li>Fixed GCC 4.7 internal compiler error {@code build_data_member_initialization, at 774 cp/semantics.c:5790}.</li> 775 <li>Fixed GCC 4.7 internal compiler error {@code redirect_eh_edge_1, at tree-eh.c:2214}. 776 (<a href="http://b.android.com/52909">Issue 52909</a>)</li> 777 <li>Fixed a GCC 4.7 segfault. 778 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245">GCC Issue</a>)</li> 779 <li>Fixed {@code <chrono>} clock resolution and enabled {@code steady_clock}. 780 (<a href="http://b.android.com/39680">Issue 39680</a>)</li> 781 <li>Fixed toolchain to enable {@code _GLIBCXX_HAS_GTHREADS} for GCC 4.7 libstdc++. 782 (<a href="http://b.android.com/41770">Issue 41770</a>, 783 <a href="http://b.android.com/41859">Issue 41859</a>)</li> 784 <li>Fixed problem with the X86 MXX/SSE code failing to link due to missing 785 {@code posix_memalign}. 786 (<a href="https://android-review.googlesource.com/#/c/51872">Change 51872</a>)</li> 787 <li>Fixed GCC4.7/X86 segmentation fault in {@code i386.c}, function 788 {@code distance_non_agu_define_in_bb()}. 789 (<a href="https://android-review.googlesource.com/#/c/50383">Change 50383</a>)</li> 790 <li>Fixed GCC4.7/X86 to restore earlier {@code cmov} behavior. 791 (<a href="http://gcc.gnu.org/viewcvs?view=revision&revision=193554">GCC Issue</a>)</li> 792 <li>Fixed handling NULL return value of {@code setlocale()} in libstdc++/GCC4.7. 793 (<a href="http://b.android.com/46718">Issue 46718</a>) 794 <li>Fixed {@code ld.gold} runtime undefined reference to {@code __exidx_start} and 795 {@code __exidx_start_end}. 796 (<a href="https://android-review.googlesource.com/#/c/52134">Change 52134</a>)</li> 797 <li>Fixed Clang 3.1 internal compiler error when using Eigen library. 798 (<a href="http://b.android.com/41246">Issue 41246</a>)</li> 799 <li>Fixed Clang 3.1 internal compiler error including {@code <chrono>} in C++11 mode. 800 (<a href="http://b.android.com/39600">Issue 39600</a>)</li> 801 <li>Fixed Clang 3.1 internal compiler error when generating object code for a method 802 call to a uniform initialized {@code rvalue}. 803 (<a href="http://b.android.com/41387">Issue 41387</a>)</li> 804 <li>Fixed Clang 3.1/X86 stack realignment. 805 (<a href="https://android-review.googlesource.com/#/c/52154">Change 52154</a>)</li> 806 <li>Fixed problem with GNU Debugger (GDB) SIGILL when debugging on Android 4.1.2. 807 (<a href="http://b.android.com/40941">Issue 40941</a>)</li> 808 <li>Fixed problem where GDB cannot set {@code source:line} breakpoints when symbols contain 809 long, indirect file paths. 810 (<a href="http://b.android.com/42448">Issue 42448</a>)</li> 811 <li>Fixed GDB {@code read_program_header} for MIPS PIE executables. 812 (<a href="https://android-review.googlesource.com/#/c/49592">Change 49592</a>)</li> 813 <li>Fixed {@code STLport} segmentation fault in {@code uncaught_exception()}. 814 (<a href="https://android-review.googlesource.com/#/c/50236">Change 50236</a>)</li> 815 <li>Fixed {@code STLport} bus error in exception handling due to unaligned access of 816 {@code DW_EH_PE_udata2}, {@code DW_EH_PE_udata4}, and {@code DW_EH_PE_udata8}.</li> 817 <li>Fixed Gabi++ infinite recursion problem with {@code nothrow new[]} operator. 818 (<a href="http://b.android.com/52833">Issue 52833</a>)</li> 819 <li>Fixed Gabi++ wrong offset to exception handler pointer. 820 (<a href="https://android-review.googlesource.com/#/c/53446">Change 53446</a>)</li> 821 <li>Removed Gabi++ redundant free on exception object 822 (<a href="https://android-review.googlesource.com/#/c/53447">Change 53447</a>)</li> 823 </ul> 824 </dd> 825 826 <dt>Other bug fixes:</dt> 827 <dd> 828 <ul> 829 <li>Fixed NDK headers: 830 <ul> 831 <li>Removed redundant definitions of {@code size_t}, {@code ssize_t}, and 832 {@code ptrdiff_t}.</li> 833 <li>Fixed MIPS and ARM {@code fenv.h} header.</li> 834 <li>Fixed {@code stddef.h} to not redefine {@code offsetof} since it already exists 835 in the toolchain.</li> 836 <li>Fixed {@code elf.h} to contain {@code Elf32_auxv_t} and {@code Elf64_auxv_t}. 837 (<a href="http://b.android.com/38441">Issue 38441</a>) 838 </li> 839 <li>Fixed the {@code #ifdef} C++ definitions in the 840 {@code OpenSLES_AndroidConfiguration.h} header file. 841 (<a href="http://b.android.com/53163">Issue 53163</a>) 842 </li> 843 </ul> 844 </li> 845 <li>Fixed {@code STLport} to abort after out of memory error instead of silently exiting. 846 </li> 847 <li>Fixed system and Gabi++ headers to be able to compile with API level 8 and lower.</li> 848 <li>Fixed {@code cpufeatures} to not parse {@code /proc/self/auxv}. 849 (<a href="http://b.android.com/43055">Issue 43055</a>)</li> 850 <li>Fixed {@code ld.gold} to not depend on host libstdc++ and on Windows platforms, 851 to not depend on the {@code libgcc_sjlj_1.dll} library.</li> 852 <li>Fixed Clang 3.1 which emits inconsistent register list in {@code .vsave} and fails 853 assembler. 854 (<a href="https://android-review.googlesource.com/#/c/49930">Change 49930</a>)</li> 855 <li>Fixed Clang 3.1 to be able to compile libgabi++ and pass the {@code test-stlport} 856 tests for MIPS build targets. 857 (<a href="https://android-review.googlesource.com/#/c/51961">Change 51961</a>)</li> 858 <li>Fixed Clang 3.1 to only enable exception by default for C++, not for C.</li> 859 <li>Fixed several issues in Clang 3.1 to pass most GNU exception tests.</li> 860 <li>Fixed scripts {@code clang} and {@code clang++} in standalone NDK compiler to detect 861 {@code -cc1} and to not specify {@code -target} when found.</li> 862 <li>Fixed {@code ndk-build} to observe {@code NDK_APP_OUT} set in {@code Application.mk}. 863 </li> 864 <li>Fixed X86 {@code libc.so} and {@code lib.a} which were missing the {@code sigsetjmp} 865 and {@code siglongjmp} functions already declared in {@code setjmp.h}. 866 (<a href="http://b.android.com/19851">Issue 19851</a>)</li> 867 <li>Patched GCC 4.4.3/4.6/4.7 libstdc++ to work with Clang in C++ 11. 868 (<a href="http://clang.llvm.org/cxx_status.html">Clang Issue</a>)</li> 869 <li>Fixed cygwin path in argument passed to {@code HOST_AWK}.</li> 870 <li>Fixed {@code ndk-build} script warning in windows when running from project's JNI 871 directory. 872 (<a href="http://b.android.com/40192">Issue 40192</a>)</li> 873 <li>Fixed problem where the {@code ndk-build} script does not build if makefile has 874 trailing whitespace in the {@code LOCAL_PATH} definition. 875 (<a href="http://b.android.com/42841">Issue 42841</a>)</li> 876 </ul> 877 </dd> 878 879 <dt>Other changes:</dt> 880 <dd> 881 <ul> 882 <li>Enabled threading support in GCC/MIPS toolchain.</li> 883 <li>Updated GCC exception handling helpers {@code __cxa_begin_cleanup} and 884 {@code __cxa_type_match} to have <em>default</em> visibility from the previous 885 <em>hidden</em> visibility in GNU libstdc++. For more information, see 886 {@code CHANGES.HTML}.</li> 887 <li>Updated build scripts so that Gabi++ and STLport static libraries are now built with 888 hidden visibility except for exception handling helpers.</li> 889 <li>Updated build so that {@code STLport} is built for ARM in Thumb mode.</li> 890 <li>Added support for {@code std::set_new_handler} in Gabi++. 891 (<a href="http://b.android.com/52805">Issue 52805</a>)</li> 892 <li>Enabled {@code FUTEX} system call in GNU libstdc++.</li> 893 <li>Updated {@code ndk-build} so that it no longer copies prebuilt static library to 894 a project's {@code obj/local/<abi>/} directory. 895 (<a href="http://b.android.com/40302">Issue 40302</a>)</li> 896 <li>Removed {@code __ARM_ARCH_5*__} from ARM {@code toolchains/*/setup.mk} script. 897 (<a href="http://b.android.com/21132">Issue 21132</a>)</li> 898 <li>Built additional GNU libstdc++ libraries in thumb for ARM.</li> 899 <li>Enabled MIPS floating-point {@code madd/msub/nmadd/nmsub/recip/rsqrt} 900 instructions with 32-bit FPU.</li> 901 <li>Enabled graphite loop optimizer in GCC 4.6 and 4.7 to allow more optimizations: 902 {@code -fgraphite}, {@code -fgraphite-identity}, {@code -floop-block}, {@code -floop-flatten}, 903 {@code -floop-interchange}, {@code -floop-strip-mine}, {@code -floop-parallelize-all}, 904 and {@code -ftree-loop-linear}. 905 (<a href="http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">info</a>)</li> 906 <li>Enabled {@code polly} for Clang 3.1 on Linux and Max OS X 32-bit hosts which analyzes 907 and optimizes memory access. (<a href="http://polly.llvm.org">info</a>)</li> 908 <li>Enabled {@code -flto} in GCC 4.7, 4.6, Clang 3.2 and Clang 3.1 on linux (Clang LTO 909 via LLVMgold.so). MIPS compiler targets are not supported because {@code ld.gold} 910 is not available.</li> 911 <li>Enabled {@code --plugin} and {@code --plugin-opt} for {@code ld.gold} in GCC 4.6/4.7. 912 </li> 913 <li>Enabled {@code --text-reorder} for {@code ld.gold} in GCC 4.7.</li> 914 <li>Configured GNU libstdc++ with {@code _GLIBCXX_USE_C99_MATH} which undefines the 915 {@code isinf} script in the bionic header. For more information, see 916 {@code CHANGES.html}.</li> 917 <li>Added {@code APP_LDFLAGS} to the build scripts. For more information, see 918 {@code ANDROID-MK.html}.</li> 919 <li>Updated build scripts to allow {@code NDK_LOG=0} to disable the {@code NDK_LOG}.</li> 920 <li>Updated build scripts to allow {@code NDK_HOST_32BIT=0} to disable the host developer 921 environment 32-bit toolchain.</li> 922 <li>Changed the default GCC/X86 flags {@code -march=} and {@code -mtune=} from 923 {@code pentiumpro} and {@code generic} to {@code i686} and {@code atom}.</li> 924 <li>Enhanced toolchain build scripts: 925 <ul> 926 <li>Fixed a race condition in {@code build-gcc.sh} for the {@code mingw} build type 927 which was preventing a significant amount of parallel build processing.</li> 928 <li>Updated {@code build-gabi++.sh} and {@code build-stlport.sh} so they can now run 929 from the NDK package. 930 (<a href="http://b.android.com/52835">Issue 52835</a>) 931 </li> 932 <li>Fixed {@code run-tests.sh} in the {@code MSys} utilities collection.</li> 933 <li>Improved 64-bit host toolchain and Canadian Cross build support.</li> 934 <li>Updated {@code build-mingw64-toolchain.sh} script to more recent version.</li> 935 <li>Added option to build {@code libgnustl_static.a} and {@code stlport_static.a} 936 without hidden visibility.</li> 937 </ul> 938 </li> 939 </ul> 940 941 </dd> 942 </dl> 943 </div> 944 </div> 945 946 947 <div class="toggle-content closed"> 948 <p><a href="#" onclick="return toggleContent(this)"> 949 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 950 alt="">Android NDK, Revision 8d</a> <em>(December 2012)</em> 951 </p> 952 953 <div class="toggle-content-toggleme"> 954 <dl> 955 <dt>Important changes:</dt> 956 <dd> 957 <ul> 958 <li>Added the GNU Compiler Collection (GCC) 4.7 compiler to the NDK. The GCC 4.6 compiler 959 is still the default, so you must to explicitly enable the new version as follows: 960 <ul> 961 <li>For {@code ndk-build}, export the {@code NDK_TOOLCHAIN_VERSION=4.7} variable 962 <em>or</em> add it to {@code Application.mk}.</li> 963 <li>For standalone builds, add the {@code --toolchain=} option to 964 {@code make-standalone-toolchain.sh}, for example: 965 <pre>--toolchain=arm-linux-androideabi-4.7</pre></li> 966 </ul> 967 <p class="note"> 968 <strong>Note:</strong> This feature is experimental. Please try it and 969 <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p> 970 </li> 971 <li>Added {@code stlport} exception support via gabi++. Note that the new gabi++ 972 depends on {@code dlopen} and related code, meaning that: 973 <ul> 974 <li>You can no longer build a <em>static</em> executable using the {@code -static} 975 option or include {@code libstlport_static.a} using 976 {@code APP_STL := stlport_static}. (You can still use the {@code -static} option 977 with a standalone toolchain.) Compiling a <em>dynamic</em> executable using 978 {@code include $(BUILD_EXECUTABLE)} continues to work because the compiler 979 automatically adds the {@code -ldl} option.</li> 980 <li>If your project links using {@code -nostdlib} and {-Wl,--no-undefined}, you 981 must manually include the {@code -ldl} option.</li> 982 </ul> 983 For more information, see {@code CPLUSPLUS-SUPPORT.html}. 984 985 <p class="note"> 986 <strong>Note:</strong> This feature is experimental and works better with the GCC 987 4.6/4.7 compilers than with GCC 4.4.3 or Clang 3.1. Please try it and 988 <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p> 989 </li> 990 <li>Added a {@code -mstack-protector-guard=} option for x86 to choose between a 991 <em>global</em> default path which is compatible with older Android C library (bionic) 992 and a new <em>tls</em> path (%gs:20) for {@code -fstack-protector}, 993 {@code -fstack-protector-all} and {@code -fstack-protector-strong} using the GCC 4.6 994 and higher compilers. 995 996 <p class="note"> 997 <strong>Note:</strong> The {@code -mstack-protector-guard} setting itself does not 998 enable any {@code -fstack-protector*} options.</p> 999 </li> 1000 <li>Added {@code android_setCpu()} function to 1001 {@code sources/android/cpufeatures/cpu-features.c} for use when auto-detection via 1002 {@code /proc} is not possible in Android 4.1 and higher. 1003 (<a href="http://code.google.com/p/chromium/issues/detail?id=164154">Chromium Issue 1004 164154</a>)</li> 1005 </ul> 1006 </dd> 1007 1008 <dt>Important bug fixes:</dt> 1009 <dd> 1010 <ul> 1011 <li>Fixed unnecessary rebuild of object files when using the {@code ndk-build} script. 1012 (<a href="http://b.android.com/39810">Issue 39810</a>)</li> 1013 <li>Fixed a linker failure with the NDK 8c release for Mac OS X 10.6.x that produced the 1014 following error: 1015 <pre> 1016 dyld: lazy symbol binding failed: Symbol not found: _memmem 1017 Referenced from: ...../arm-linux-androideabi/bin/ld 1018 Expected in: /usr/lib/libSystem.B.dylib</pre> 1019 This problem was caused by building on Mac OS X 10.7, which produced binaries that were 1020 not compatible with Mac OS 10.6.x and the NDK. 1021 </li> 1022 <li>Removed the {@code -x c++} options from the Clang++ standalone build script. 1023 (<a href="http://b.android.com/39089">Issue 39089</a>)</li> 1024 <li>Fixed issues using the {@code NDK_TOOLCHAIN_VERSION=clang3.1} option in Cygwin. 1025 (<a href="http://b.android.com/39585">Issue 39585</a>)</li> 1026 <li>Fixed the {@code make-standalone-toolchain.sh} script to allow generation of a 1027 standalone toolchain using the Cygwin or MinGW environments. The resulting toolchain 1028 can be used in Cygwin, MingGW or CMD.exe environments. 1029 (<a href="http://b.android.com/39915">Issue 39915</a>, 1030 <a href="http://b.android.com/39585">Issue 39585</a>)</li> 1031 <li>Added missing {@code SL_IID_ANDROIDBUFFERQUEUESOURCE} option in android-14 builds for 1032 ARM and X86. 1033 (<a href="http://b.android.com/40625">Issue 40625</a>)</li> 1034 <li>Fixed x86 CPU detection for the {@code ANDROID_CPU_X86_FEATURE_MOVBE} feature. 1035 (<a href="http://b.android.com/39317">Issue 39317</a>)</li> 1036 <li>Fixed an issue preventing the Standard Template Library (STL) from using C++ 1037 sources that do not have a {@code .cpp} file extension.</li> 1038 <li>Fixed GCC 4.6 ARM internal compiler error <em>at reload1.c:1061</em>. 1039 (<a href="http://b.android.com/20862">Issue 20862</a>)</li> 1040 <li>Fixed GCC 4.4.3 ARM internal compiler error <em>at emit-rtl.c:1954</em>. 1041 (<a href="http://b.android.com/22336">Issue 22336</a>)</li> 1042 <li>Fixed GCC 4.4.3 ARM internal compiler error <em>at postreload.c:396</em>. 1043 (<a href="http://b.android.com/22345">Issue 22345</a>)</li> 1044 <li>Fixed problem with GCC 4.6/4.7 skipping lambda functions. 1045 (<a href="http://b.android.com/35933">Issue 35933</a>)</li> 1046 </ul> 1047 </dd> 1048 1049 <dt>Other bug fixes:</dt> 1050 <dd> 1051 <ul> 1052 <li>NDK header file fixes: 1053 <ul> 1054 <li>Fixed {@code __WINT_TYPE__} and {@code wint_t} to be the same type.</li> 1055 <li>Corrected typo in {@code android/bitmap.h}. 1056 (<a href="http://b.android.com/15134">Issue 15134</a>) 1057 </li> 1058 <li>Corrected typo in {@code errno.h}.</li> 1059 <li>Added check for the presence of {@code __STDC_VERSION__} in {@code sys/cdefs.h}. 1060 (<a href="http://b.android.com/14627">Issue 14627</a>) 1061 </li> 1062 <li>Reorganized headers in {@code byteswap.h} and {@code dirent.h}.</li> 1063 <li>Fixed {@code limits.h} to include {@code page.h} which provides {@code PAGE_SIZE} 1064 settings. 1065 (<a href="http://b.android.com/39983">Issue 39983</a>) 1066 </li> 1067 <li>Fixed return type of {@code glGetAttribLocation()} and 1068 {@code glGetUniformLocation()} from {@code int} to {@code GLint}.</li> 1069 <li>Fixed {@code __BYTE_ORDER} constant for x86 builds. 1070 (<a href="http://b.android.com/39824">Issue 39824</a>) 1071 </li> 1072 </ul> 1073 </li> 1074 <li>Fixed {@code ndk-build} script to not overwrite {@code -Os} with {@code -O2} for ARM 1075 builds.</li> 1076 <li>Fixed build scripts to allow overwriting of {@code HOST_AWK}, {@code HOST_SED}, and 1077 {@code HOST_MAKE} settings.</li> 1078 <li>Fixed issue for {@code ld.gold} on {@code fsck_msdos} builds linking objects built by 1079 the Intel C/C++ compiler (ICC).</li> 1080 <li>Fixed ARM EHABI support in Clang to conform to specifications.</li> 1081 <li>Fixed GNU Debugger (GDB) to shorten the time spent on walking the target's link map 1082 during {@code solib} events. 1083 (<a href="http://b.android.com/38402">Issue 38402</a>)</li> 1084 <li>Fixed missing {@code libgcc.a} file when linking shared libraries.</li> 1085 </ul> 1086 </dd> 1087 1088 <dt>Other changes:</dt> 1089 <dd> 1090 <ul> 1091 <li>Backported 64-bit built-in atomic functions for ARM to GCC 4.6.</li> 1092 <li>Added documentation for audio output latency, along with other documentation and 1093 fixes.</li> 1094 <li>Fixed debug builds with Clang so that non-void functions now raise a {@code SIGILL} 1095 signal for paths without a return statement.</li> 1096 <li>Updated {@code make-standalone-toolchain.sh} to accept the suffix {@code -clang3.1} 1097 which is equivalent to adding {@code --llvm-version=3.1} to the GCC 4.6 toolchain.</li> 1098 <li>Updated GCC and Clang bug report URL to: 1099 <a href="http://source.android.com/source/report-bugs.html">http://source.android.com/source/report-bugs.html</a></li> 1100 <li>Added ARM ELF support to {@code llvm-objdump}.</li> 1101 <li>Suppressed <em>treating c input as c++</em> warning for Clang builds.</li> 1102 <li>Updated build so that only the 32-bit version of {@code libiberty.a} is built and 1103 placed in {@code lib32/}.</li> 1104 </ul> 1105 </dd> 1106 </dl> 1107 </div> 1108 </div> 1109 1110 1111 <div class="toggle-content closed"> 1112 <p><a href="#" onclick="return toggleContent(this)"> 1113 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1114 alt="">Android NDK, Revision 8c</a> <em>(November 2012)</em> 1115 </p> 1116 1117 <div class="toggle-content-toggleme"> 1118 <dl> 1119 <dt>Important changes:</dt> 1120 1121 <dd> 1122 <ul> 1123 <li>Added the Clang 3.1 compiler to the NDK. The GNU Compiler Collection (GCC) 4.6 is 1124 still the default, so you must explicitly enable the Clang compiler option as follows: 1125 <ul> 1126 <li>For {@code ndk-build}, export {@code NDK_TOOLCHAIN_VERSION=clang3.1} <em>or</em> 1127 add this environment variable setting to {@code Application.mk}.</li> 1128 <li>For standalone builds, add {@code --llvm-version=3.1} to 1129 {@code make-standalone-toolchain.sh} and replace {@code CC} and {@code CXX} in your 1130 makefile with {@code <tool-path>/bin/clang} and 1131 {@code <tool-path>/bin/clang++}. See {@code STANDALONE-TOOLCHAIN.html} for 1132 details.</li> 1133 </ul> 1134 <p class="note"><strong>Note:</strong> This feature is experimental. Please try it and 1135 <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p></li> 1136 <li>Added Gold linker {@code ld.gold} for the Windows toolchain. Gold linker is also the 1137 default for ARM and X86 on all hosts. You may override it to use the {@code ld.bfd} 1138 linker by adding {@code LOCAL_LDFLAGS += -fuse-ld=bfd} to {@code Android.mk}, or by passing 1139 {@code -fuse-ld=bfd} to the g++/clang++ command line that does the linking.</li> 1140 <li>Added checks for spaces in the NDK path to the {@code ndk-build[.cmd]} and 1141 {@code ndk-gdb} scripts, to prevent build errors that are difficult to diagnose.</li> 1142 <li>Made the following changes to API level handling: 1143 <ul> 1144 <li>Modified build logic so that projects that specify {@code android-10} through 1145 {@code android-13} in {@code APP_PLATFORM}, {@code project.properties} or 1146 {@code default.properties} link against {@code android-9} instead of 1147 {@code android-14}. 1148 <li>Updated build so that executables using android-16 (Jelly Bean) or higher are 1149 compiled with the {@code -fPIE} option for position-independent executables (PIE). 1150 A new {@code APP_PIE} option allows you to control this behavior. See {@code 1151 APPLICATION-MK.html} for details. 1152 <p class="note"> 1153 <strong>Note:</strong> All API levels above 14 still link against {@code 1154 platforms/android-14} and no new {@code platforms/android-N} have been added. 1155 </p></li> 1156 <li>Modified {@code ndk-build} to provide warnings if the adjusted API level is larger 1157 than {@code android:minSdkVersion} in the project's {@code AndroidManifest.xml}.</li> 1158 </ul> 1159 </li> 1160 <li>Updated the {@code cpu-features} helper library to include more ARM-specific features. 1161 See {@code sources/android/cpufeatures/cpu-features.h} for details.</li> 1162 <li>Modified the long double on the X86 platform to be 8 bytes. This data type is now the 1163 same size as a double, but is still treated as a distinct type.</li> 1164 <li>Updated build for {@code APP_ABI=armeabi-v7a}: 1165 <ul> 1166 <li>Modified this build type to pass the {@code -march=armv7-a} parameter 1167 to the linker. This change ensures that v7-specific libraries and {@code crt*.o} are 1168 linked correctly.</li> 1169 <li>Added {@code -mfpu=vfpv3-d16} to {@code ndk-build} instead of the 1170 {@code -mfpu=vfp} option used in previous releases.</li> 1171 </ul> 1172 </li> 1173 </ul> 1174 </dd> 1175 </dl> 1176 1177 <dl> 1178 <dt>Important bug fixes:</dt> 1179 1180 <dd> 1181 <ul> 1182 <li>Fixed an issue where running {@code make-standalone-toolchain.sh} with root privileges 1183 resulted in the stand alone tool chain being inaccessible to some users. 1184 (<a href="http://b.android.com/35279">Issue 35279</a>) 1185 <ul> 1186 <li>All files and executables in the NDK release package are set to have read and 1187 execute permissions for all.</li> 1188 <li>The ownership/group of {@code libstdc++.a} is now preserved when copied.</li> 1189 </ul> 1190 </li> 1191 <li>Removed redundant {@code \r} from Windows prebuilt {@code echo.exe}. The redundant 1192 {@code \r} caused {@code gdb.setup} to fail in the GNU Debugger (GDB) because it 1193 incorrectly became part of the path. 1194 (<a href="http://b.android.com/36054">Issue 36054</a>)</li> 1195 <li>Fixed Windows parallel builds that sometimes failed due to timing issues in the 1196 {@code host-mkdir} implementation. 1197 (<a href="http://b.android.com/25875">Issue 25875</a>)</li> 1198 <li>Fixed GCC 4.4.3 GNU {@code libstdc++} to <em>not</em> merge {@code typeinfo} names by 1199 default. For more details, see 1200 {@code toolchain repo gcc/gcc-4.4.3/libstdc++-v3/libsupc++/typeinfo}. 1201 (<a href="http://b.android.com/22165">Issue 22165</a>)</li> 1202 <li>Fixed problem on {@code null} context in GCC 4.6 1203 {@code cp/mangle.c::write_unscoped_name}, where GCC may crash when the context is 1204 {@code null} and dereferenced in {@code TREE_CODE}.</li> 1205 <li>Fixed GCC 4.4.3 crashes on ARM NEON-specific type definitions for floats. 1206 (<a href="http://b.android.com/34613">Issue 34613</a>)</li> 1207 <li>Fixed the {@code STLport} internal {@code _IteWrapper::operator*()} implementation 1208 where a stale stack location holding the dereferenced value was returned and caused 1209 runtime crashes. 1210 (<a href="http://b.android.com/38630">Issue 38630</a>)</li> 1211 1212 <li>ARM-specific fixes: 1213 <ul> 1214 <li>Fixed ARM GCC 4.4.3/4.6 {@code g++} to not warn that the <em>mangling of 1215 <va_list> was changed in GCC 4.4</em>. The workaround using the 1216 {@code -Wno-psabi} switch to avoid this warning is no longer required.</li> 1217 <li>Fixed an issue when a project with {@code .arm} or {@code .neon} suffixes in 1218 {@code LOCAL_SRC_FILES} also used {@code APP_STL}. With {@code APP_STL}, the 1219 {@code ndk-build} script searches for C++ files in {@code LOCAL_SRC_FILES} before 1220 adding STL {@code header/lib} paths to compilation. Modified {@code ndk-build} to 1221 filter out {@code .arm} and {@code .neon} suffixes before the search, otherwise items 1222 in {@code LOCAL_SRC_FILES} like {@code myfile.cpp.arm.neon} won't be compiled as C++ 1223 code.</li> 1224 <li>Fixed {@code binutils-2.21/ld.bfd} to be capable of linking object from older 1225 binutils without {@code tag_FP_arch}, which was producing <em>assertion fail</em> 1226 error messages in GNU Binutils. 1227 (<a href="http://b.android.com/35209">Issue 35209</a>) 1228 </li> 1229 <li>Removed <em>Unknown EABI object attribute 44</em> warning when 1230 {@code binutils-2.19/ld} links prebuilt object by newer {@code binutils-2.21}</li> 1231 <li>Fixed an issue in GNU {@code stdc++} compilation with both {@code -mthumb} and 1232 {@code -march=armv7-a}, by modifying {@code make-standalone-toolchain.sh} to populate 1233 {@code headers/libs} in sub-directory {@code armv7-a/thumb}. 1234 (<a href="http://b.android.com/35616">Issue 35616</a>) 1235 </li> 1236 <li>Fixed <em>unresolvable R_ARM_THM_CALL relocation</em> error. 1237 (<a href="http://b.android.com/35342">Issue 35342</a>) 1238 </li> 1239 <li>Fixed internal compiler error at {@code reload1.c:3633}, caused by the ARM 1240 back-end expecting the wrong operand type when sign-extend from {@code char}. 1241 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50099">GCC Issue 50099</a>)</li> 1242 <li>Fixed internal compiler error with negative shift amount. 1243 (<a href="http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00594.html">GCC Issue</a>)</li> 1244 </ul> 1245 </li> 1246 1247 <li>Fixed {@code -fstack-protector} for X86, which is also the default for the 1248 {@code ndk-build} x86 ABI target.</li> 1249 1250 <li>MIPS-specific fixes: 1251 <ul> 1252 <li>Fixed {@code STLport} endian-ness by setting {@code _STLP_LITTLE_ENDIAN} to 1 when 1253 compiling MIPS {@code libstlport_*}.</li> 1254 <li>Fixed GCC {@code __builtin_unreachable} issue when compiling LLVM. 1255 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54369">GCC Issue 54369</a>)</li> 1256 <li>Backported fix for {@code cc1} compile process consuming 100% CPU. 1257 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50380">GCC Issue 50380</a>)</li> 1258 </ul> 1259 </li> 1260 1261 <li>GNU Debugger-specific fixes: 1262 <ul> 1263 <li>Disabled Python support in gdb-7.x at build, otherwise the gdb-7.x configure 1264 function may pick up whatever Python version is available on the host and build 1265 {@code gdb} with a hard-wired dependency on a specific version of Python. 1266 (<a href="http://b.android.com/36120">Issue 36120</a>) 1267 </li> 1268 <li>Fixed {@code ndk-gdb} when {@code APP_ABI} contains {@code all} and matchs none 1269 of the known architectures. 1270 (<a href="http://b.android.com/35392">Issue 35392</a>) 1271 </li> 1272 <li>Fixed Windows pathname support, by keeping the {@code :} character if it looks 1273 like it could be part of a Windows path starting with a drive letter. 1274 (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12843">GDB Issue 12843</a>) 1275 </li> 1276 <li>Fixed adding of hardware breakpoint support for ARM in {@code gdbserver}. 1277 (<a href="http://sourceware.org/ml/gdb-patches/2011-09/msg00200.html">GDB Issue</a>) 1278 </li> 1279 <li>Added fix to only read the current {@code solibs} when the linker is consistent. 1280 This change speeds up {@code solib} event handling. 1281 (<a href="http://b.android.com/37677">Issue 37677</a>) 1282 </li> 1283 <li>Added fix to make repeated attempts to find {@code solib} breakpoints. GDB now 1284 retries {@code enable_break()} during every call to {@code svr4_current_sos()} until 1285 it succeeds. 1286 (<a href="https://android-review.googlesource.com/#/c/43563">Change 43563</a>)</li> 1287 <li>Fixed an issue where {@code gdb} would not stop on breakpoints placed in 1288 {@code dlopen-ed} libraries. 1289 (<a href="http://b.android.com/34856">Issue 34856</a>) 1290 </li> 1291 <li>Fixed {@code SIGILL} in dynamic linker when calling {@code dlopen()}, on system 1292 where {@code /system/bin/linker} is stripped of symbols and 1293 {@code rtld_db_dlactivity()} is implemented as {@code Thumb}, due to not preserving 1294 {@code LSB} of {@code sym_addr}. 1295 (<a href="http://b.android.com/37147">Issue 37147</a>) 1296 </li> 1297 </ul> 1298 </li> 1299 </ul> 1300 </dd> 1301 </dl> 1302 1303 <dl> 1304 <dt>Other bug fixes:</dt> 1305 1306 <dd> 1307 <ul> 1308 <li>Fixed NDK headers: 1309 <ul> 1310 <li>Fixed {@code arch-mips/include/asm/*} code that was incorrectly removed from 1311 original kernel. (<a href="https://android-review.googlesource.com/#/c/43335">Change 1312 43335</a>)</li> 1313 <li>Replaced struct member data {@code __unused} with {@code __linux_unused} in 1314 {@code linux/sysctl.h} and {@code linux/icmp.h} to avoid conflict with 1315 {@code #define __unused} in {@code sys/cdefs.h}.</li> 1316 <li>Fixed {@code fenv.h} for enclosed C functions with {@code __BEGIN_DECLS} and 1317 {@code __END_DECLS}.</li> 1318 <li>Removed unimplemented functions in {@code malloc.h}.</li> 1319 <li>Fixed {@code stdint.h} defintion of {@code uint64_t} for ANSI compilers. 1320 (<a href="http://b.android.com/1952">Issue 1952</a>)</li> 1321 <li>Fixed preprocessor macros in {@code <arch>/include/machine/*}.</li> 1322 <li>Replaced {@code link.h} for MIPS with new version supporting all platforms.</li> 1323 <li>Removed {@code linux-unistd.h}</li> 1324 <li>Move GLibc-specific macros {@code LONG_LONG_MIN}, {@code LONG_LONG_MAX} and 1325 {@code ULONG_LONG_MAX} from {@code <pthread.h>} to {@code <limits.h>}.</li> 1326 </ul> 1327 </li> 1328 <li>Fixed a buffer overflow in {@code ndk-stack-parser}.</li> 1329 <li>Fixed {@code _STLP_USE_EXCEPTIONS}, when not defined, to omit all declarations 1330 and uses of {@code __Named_exception}. Compiling and use of {@code __Named_exception} 1331 settings only occurs when {@code STLport} is allowed to use exceptions.</li> 1332 <li>Fixed building of Linux-only NDK packages without also building Windows code. Use the 1333 following settings to perform this type of build: 1334 <pre>./build/tools/make-release.sh --force --systems=linux-x86</pre></li> 1335 <li>Fixed {@code libc.so} so it does not export {@code atexit()} and {@code __do_handler}. 1336 These symbols are exported for ARM builds by the system version of the C library to 1337 support legacy native libraries. NDK-generated should never reference them directly. 1338 Instead, each shared library or executable should embed its own version of these symbols, 1339 provided by {@code crtbegin_*.o}. 1340 <p>If your project is linked with the {@code -nostdlib -Wl,--no-undefined} options, you 1341 must provide your own {@code __dso_handle} because {@code crtbegin_so.o} is not linked in 1342 this case. The content of {@code __dso_handle} does not matter, as shown in the following 1343 example code:</p> 1344 <pre> 1345 extern "C" { 1346 extern void *__dso_handle __attribute__((__visibility__ ("hidden"))); 1347 void *__dso_handle; 1348 } 1349 </pre> 1350 </li> 1351 <li>Fixed symbol decoder for ARM used in {@code objdump} for {@code plt} entries to 1352 generate a more readable form {@code function@plt}.</li> 1353 <li>Removed the following symbols, introduced in GCC 4.6 {@code libgcc.a}, from 1354 the X86 platform {@code libc.so} library: {@code __aeabi_idiv0}, {@code __aeabi_ldiv0}, 1355 {@code __aeabi_unwind_cpp_pr1}, and {@code __aeabi_unwind_cpp_pr2}.</li> 1356 <li>Removed unused {@code .ctors}, {@code .dtors}, and {@code .eh_frame} in MIPS 1357 {@code crt*_so.S}.</li> 1358 <li>Updated {@code ndk-gdb} so that it only takes the last line of output for 1359 {@code ndk-build} {@code DUMP_XXXX}. This change ensures that if {@code Application.mk} or 1360 {@code Android.mk} print something with {@code $(info ...)} syntax, it does not get 1361 injected into the result of {@code DUMP_XXXX}. 1362 (<a href="https://groups.google.com/d/msg/android-ndk/-/ew0lTWGr1UEJ">More info</a>)</li> 1363 </ul> 1364 </dd> 1365 </dl> 1366 1367 <dl> 1368 <dt>Other changes:</dt> 1369 1370 <dd> 1371 <ul> 1372 <li>Removed {@code arch-x86} and {@code arch-mips} headers from 1373 {@code platforms/android-[3,4,5,8]}. Those headers were incomplete, since both X86 and 1374 MIPS ABIs are only supported at API 9 or higher.</li> 1375 <li>Simplified c++ include path in standalone packages, as shown below. 1376 (<a href="http://b.android.com/35279">Issue 35279</a>) 1377 <pre> 1378 <path>/arm-linux-androideabi/include/c++/4.6.x-google 1379 to: 1380 <path>/include/c++/4.6/ 1381 </pre></li> 1382 <li>Fixed {@code ndk-build} to recognize more C++ file extensions by default: 1383 {@code .cc .cp .cxx .cpp .CPP .c++ .C}. You may still use {@code LOCAL_CPP_EXTENSION} to 1384 overwrite these extension settings.</li> 1385 <li>Fixed an issue in {@code samples/san-angeles} that caused a black screen or freeze 1386 frame on re-launch.</li> 1387 <li>Replaced deprecated APIs in NDK samples. 1388 (<a href="http://b.android.com/20017">Issue 20017</a>) 1389 <ul> 1390 <li>{@code hello-gl2} from android-5 to android-7</li> 1391 <li>{@code native-activity} from android-9 to android-10</li> 1392 <li>{@code native-audio} from android-9 to android-10</li> 1393 <li>{@code native-plasma} from android-9 to android-10</li> 1394 </ul> 1395 </li> 1396 <li>Added new branding for Android executables with a simpler scheme in section 1397 {@code .note.android.ident} (defined in {@code crtbegin_static/dynamic.o}) so that 1398 debugging tools can act accordingly. The structure member and values are defined as 1399 follows: 1400 <pre> 1401 static const struct { 1402 int32_t namesz; /* = 8, sizeof ("Android") */ 1403 int32_t descsz; /* = 1 * sizeof(int32_t) */ 1404 int32_t type; /* = 1, ABI_NOTETYPE */ 1405 char name[sizeof "Android"]; /* = "Android" */ 1406 int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */ 1407 } 1408 </pre> 1409 <p>The previous branding options in section {@code .note.ABI-tag} are deprecated.</p> 1410 </li> 1411 <li>Added a new script {@code run-tests-all.sh} which calls {@code run-tests.sh} and 1412 {@code standalone/run.sh} with various conditions. The script {@code run-tests.sh} runs 1413 without the {@code --abi} option, and is enhanced to compile most of the tests for all 1414 supported ABIs and run on all attached devices</li> 1415 </ul> 1416 </dd> 1417 </dl> 1418 1419 </div> 1420 </div> 1421 1422 <div class="toggle-content closed"> 1423 <p><a href="#" onclick="return toggleContent(this)"> 1424 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1425 alt="">Android NDK, Revision 8b</a> <em>(July 2012)</em> 1426 </p> 1427 1428 <div class="toggle-content-toggleme"> 1429 <p>The main features of this release are a new GNU Compiler Collection (GCC) 4.6 toolchain and 1430 GNU Debugger (GDB) 7.3.x which adds debugging support for the Android 4.1 (API Level 16) system 1431 image.</p> 1432 1433 <dl> 1434 <dt>Important bug fixes:</dt> 1435 1436 <dd> 1437 <ul> 1438 <li>Fixed {@code LOCAL_SHORT_COMMANDS} issues on Mac OS, Windows Cygwin environments for 1439 static libraries. List file generation is faster, and it is not regenerated to avoid repeated 1440 project rebuilds.</li> 1441 <li>Fixed several issues in {@code ndk-gdb}: 1442 <ul> 1443 <li>Updated tool to pass flags {@code -e}, {@code -d} and {@code -s} to adb more 1444 consistently.</li> 1445 <li>Updated tool to accept device serial names containing spaces.</li> 1446 <li>Updated tool to retrieve {@code /system/bin/link} information, so {@code gdb} on 1447 the host can set a breakpoint in {@code __dl_rtld_db_dlactivity} and be aware of linker activity 1448 (e.g., rescan {@code solib} symbols when {@code dlopen()} is called).</li> 1449 </ul> 1450 </li> 1451 <li>Fixed {@code ndk-build clean} on Windows, which was failing to remove 1452 {@code ./libs/*/lib*.so}.</li> 1453 <li>Fixed {@code ndk-build.cmd} to return a non-zero {@code ERRORLEVEL} when {@code make} 1454 fails.</li> 1455 <li>Fixed {@code libc.so} to stop incorrectly exporting the {@code __exidx_start} and 1456 {@code __exidx_end} symbols.</li> 1457 <li>Fixed {@code SEGV} when unwinding the stack past {@code __libc_init} for ARM and 1458 MIPS.</li> 1459 </ul> 1460 </dd> 1461 </dl> 1462 1463 <dl> 1464 <dt>Important changes:</dt> 1465 1466 <dd> 1467 <ul> 1468 <li>Added GCC 4.6 toolchain ({@code binutils} 2.21 with {@code gold} and GDB 7.3.x) to 1469 co-exist with the original GCC 4.4.3 toolchain ({@code binutils} 2.19 and GDB 6.6). 1470 <ul> 1471 <li>GCC 4.6 is now the default toolchain. You may set {@code 1472 NDK_TOOLCHAIN_VERSION=4.4.3} in {@code Application.mk} to select the original one.</li> 1473 <li>Support for the {@code gold} linker is only available for ARM and x86 1474 architectures on Linux and Mac OS hosts. This support is disabled by default. Add {@code 1475 LOCAL_LDLIBS += -fuse-ld=gold} in {@code Android.mk} to enable it.</li> 1476 <li>Programs compiled with {@code -fPIE} require the new {@code GDB} for debugging, 1477 including binaries in Android 4.1 (API Level 16) system images.</li> 1478 <li>The {@code binutils} 2.21 {@code ld} tool contains back-ported fixes from 1479 version 2.22: 1480 <ul> 1481 <li>Fixed {@code ld --gc-sections}, which incorrectly retains zombie references to 1482 external libraries. (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=13177">more 1483 info</a>).</li> 1484 <li>Fixed ARM {@code strip} command to preserve the original {@code p_align} and 1485 {@code p_flags} in {@code GNU_RELRO} section if they are valid. Without this fix, programs 1486 built with {@code -fPIE} could not be debugged. (<a 1487 href="http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.552&r2=1.553">more info</a>)</li> 1488 </ul> 1489 </li> 1490 <li>Disabled {@code sincos()} optimization for compatibility with older 1491 platforms.</li> 1492 </ul> 1493 </li> 1494 1495 <li>Updated build options to enable the Never eXecute (NX) bit and {@code relro}/{@code 1496 bind_now} protections by default: 1497 <ul> 1498 <li>Added {@code --noexecstack} to assembler and {@code -z noexecstack} to linker 1499 that provides NX protection against buffer overflow attacks by enabling NX bit on stack and 1500 heap.</li> 1501 <li>Added {@code -z relro} and {@code -z now} to linker for hardening of internal 1502 data sections after linking to guard against security vulnerabilities caused by memory corruption. 1503 (more info: <a href="http://www.akkadia.org/drepper/nonselsec.pdf">1</a>, 1504 <a href="http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html">2</a>)</li> 1505 1506 <li>These features can be disabled using the following options: 1507 <ol> 1508 <li>Disable NX protection by setting the {@code --execstack} option for the 1509 assembler and {@code -z execstack} for the linker.</li> 1510 <li>Disable hardening of internal data by setting the {@code -z norelro} and 1511 {@code -z lazy} options for the linker.</li> 1512 <li>Disable these protections in the NDK {@code jni/Android.mk} by setting the 1513 following options: 1514 <pre> 1515 LOCAL_DISABLE_NO_EXECUTE=true # disable "--noexecstack" and "-z noexecstack" 1516 DISABLE_RELRO=true # disable "-z relro" and "-z now" 1517 </pre> 1518 </li> 1519 </ol> 1520 <p>See {@code docs/ANDROID-MK.html} for more details.</p> 1521 </li> 1522 </ul> 1523 </li> 1524 1525 <li>Added branding for Android executables with the {@code .note.ABI-tag} section (in 1526 {@code crtbegin_static/dynamic.o}) so that debugging tools can act accordingly. The structure 1527 member and values are defined as follows: 1528 <pre> 1529 static const struct { 1530 int32_t namesz; /* = 4, sizeof ("GNU") */ 1531 int32_t descsz; /* = 6 * sizeof(int32_t) */ 1532 int32_t type; /* = 1 */ 1533 char name[sizeof "GNU"]; /* = "GNU" */ 1534 int32_t os; /* = 0 */ 1535 int32_t major; /* = 2 */ 1536 int32_t minor; /* = 6 */ 1537 int32_t teeny; /* = 15 */ 1538 int32_t os_variant; /* = 1 */ 1539 int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */ 1540 }</pre> 1541 </li> 1542 </ul> 1543 </dd> 1544 </dl> 1545 1546 <dl> 1547 <dt>Other bug fixes:</dt> 1548 1549 <dd> 1550 <ul> 1551 <li>Fixed {@code mips-linux-gnu} relocation truncated to fit {@code R_MIPS_TLS_LDM} issue. 1552 (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12637">more info</a>)</li> 1553 <li>Fixed {@code ld} tool segfaults when using {@code --gc-sections}. 1554 (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12845">more info</a>) 1555 </li> 1556 <li>Fixed MIPS {@code GOT_PAGE} counting issue. 1557 (<a href="http://sourceware.org/ml/binutils/2011-05/msg00198.html">more info</a>)</li> 1558 <li>Fixed follow warning symbol link for {@code mips_elf_count_got_symbols}.</li> 1559 <li>Fixed follow warning symbol link for {@code mips_elf_allocate_lazy_stub}.</li> 1560 <li>Moved MIPS {@code .dynamic} to the data segment, so that it is writable.</li> 1561 <li>Replaced hard-coded values for symbols with correct segment sizes for MIPS.</li> 1562 <li>Removed the {@code -mno-shared} option from the defaults in the MIPS toolchain. 1563 The default for Android toolchain is {@code -fPIC} (or {@code -fpic} if supported). If you do not 1564 explicitly specify {@code -mshared}, {@code -fpic}, {@code -fPIC}, {@code -fpie}, or {@code -fPIE}, 1565 the MIPS compiler adds {@code -mno-shared} that turns off PIC. Fixed compiler not to add 1566 {@code -mno-shared} in this case.</li> 1567 <li>Fixed wrong package names in samples {@code hello-jni} and {@code two-libs} so that 1568 the {@code tests} project underneath it can compile.</li> 1569 </ul> 1570 </dd> 1571 </dl> 1572 1573 <dl> 1574 <dt>Other Changes:</dt> 1575 1576 <dd> 1577 <ul> 1578 <li>Changed locations of binaries: 1579 <ul> 1580 <li>Moved {@code gdbserver} from 1581 {@code toolchain/<arch-os-ver>/prebuilt/gdbserver} to 1582 {@code prebuilt/android-<arch>/gdbserver/gdbserver}.</li> 1583 <li>Renamed x86 toolchain prefix from {@code i686-android-linux-} to 1584 {@code i686-linux-android-}.</li> 1585 <li>Moved {@code sources/cxx-stl/gnu-libstdc++/include} and {@code lib} to 1586 {@code sources/cxx-stl/gnu-libstdc++/4.6} when compiled with GCC 4.6, or 1587 {@code sources/cxx-stl/gnu-libstdc++/4.4.3} when compiled with GCC 4.4.3.</li> 1588 <li>Moved {@code libbfd.a} and {@code libintl.a} from {@code lib/} to {@code 1589 lib32/}.</li> 1590 </ul> 1591 </li> 1592 1593 <li>Added and improved various scripts in the rebuild and test NDK toolchain: 1594 <ul> 1595 <li>Added {@code build-mingw64-toolchain.sh} to generate a new Linux-hosted toolchain 1596 that generates Win32 and Win64 executables.</li> 1597 <li>Improved speed of {@code download-toolchain-sources.sh} by using the {@code 1598 clone} command and only using {@code checkout} for the directories that are needed to build the NDK 1599 toolchain binaries.</li> 1600 <li>Added {@code build-host-gcc.sh} and {@code build-host-gdb.sh} scripts.</li> 1601 <li>Added {@code tests/check-release.sh} to check the content of a given NDK 1602 installation directory, or an existing NDK package.</li> 1603 <li>Rewrote the {@code tests/standalone/run.sh} standalone tests .</li> 1604 </ul> 1605 </li> 1606 <li>Removed {@code if_dl.h} header from all platforms and architectures. The {@code 1607 AF_LINK} and {@code sockaddr_dl} elements it describes are specific to BSD (i.e., they don't exist 1608 in Linux).</li> 1609 </ul> 1610 </dd> 1611 </dl> 1612 1613 </div> 1614 </div> 1615 1616 <div class="toggle-content closed"> 1617 <p><a href="#" onclick="return toggleContent(this)"> 1618 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1619 alt="">Android NDK, Revision 8</a> <em>(May 2012)</em> 1620 </p> 1621 1622 <div class="toggle-content-toggleme"> 1623 <p>This release of the NDK includes support for MIPS ABI and a few additional fixes.</p> 1624 1625 <dl> 1626 <dt>New features:</dt> 1627 1628 <dd> 1629 <ul> 1630 <li>Added support for the MIPS ABI, which allows you to generate machine code that runs on 1631 compatible MIPS-based Android devices. Major features for MIPS include MIPS-specific 1632 toolchains, system headers, libraries and debugging support. For more details regarding 1633 MIPS support, see {@code docs/CPU-MIPS.html} in the NDK package. 1634 1635 <p>By default, code is generated for ARM-based devices. You can add {@code mips} to 1636 your {@code APP_ABI} definition in your {@code Application.mk} file to build 1637 for MIPS platforms. For example, the following line instructs {@code ndk-build} 1638 to build your code for three distinct ABIs:</p> 1639 1640 <pre>APP_ABI := armeabi armeabi-v7a <strong>mips</strong></pre> 1641 1642 <p>Unless you rely on architecture-specific assembly sources, such as ARM assembly 1643 code, you should not need to touch your {@code Android.mk} files to build MIPS 1644 machine code.</p> 1645 </li> 1646 1647 <li>You can build a standalone MIPS toolchain using the {@code --arch=mips} 1648 option when calling <code>make-standalone-toolchain.sh</code>. See 1649 {@code docs/STANDALONE-TOOLCHAIN.html} for more details. 1650 </li> 1651 </ul> 1652 1653 <p class="note"><strong>Note:</strong> To ensure that your applications are available 1654 to users only if their devices are capable of running them, Google Play filters applications based 1655 on the instruction set information included in your application ? no action is needed on your part 1656 to enable the filtering. Additionally, the Android system itself also checks your application at 1657 install time and allows the installation to continue only if the application provides a library that 1658 is compiled for the device's CPU architecture.</p> 1659 </dd> 1660 1661 <dt>Important bug fixes:</dt> 1662 1663 <dd> 1664 <ul> 1665 <li>Fixed a typo in GAbi++ implementation where the result of {@code 1666 dynamic_cast<D>(b)} of base class object {@code b} to derived class {@code D} is 1667 incorrectly adjusted in the opposite direction from the base class. 1668 (<a href="http://b.android.com/28721">Issue 28721</a>) 1669 </li> 1670 <li>Fixed an issue in which {@code make-standalone-toolchain.sh} fails to copy 1671 {@code libsupc++.*}.</li> 1672 </ul> 1673 </dd> 1674 1675 <dt>Other bug fixes:</dt> 1676 1677 <dd> 1678 <ul> 1679 <li>Fixed {@code ndk-build.cmd} to ensure that {@code ndk-build.cmd} works correctly even 1680 if the user has redefined the {@code SHELL} environment variable, which may be changed 1681 when installing a variety of development tools in Windows environments. 1682 </li> 1683 </ul> 1684 </dd> 1685 </dl> 1686 </div> 1687 </div> 1688 1689 <div class="toggle-content closed"> 1690 <p><a href="#" onclick="return toggleContent(this)"> 1691 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1692 alt="">Android NDK, Revision 7c</a> <em>(April 2012)</em> 1693 </p> 1694 1695 <div class="toggle-content-toggleme"> 1696 <p>This release of the NDK includes an important fix for Tegra2-based devices, and a few 1697 additional fixes and improvements:</p> 1698 1699 <dl> 1700 <dt>Important bug fixes:</dt> 1701 1702 <dd> 1703 <ul> 1704 <li>Fixed GNU STL armeabi-v7a binaries to not crash on non-NEON 1705 devices. The files provided with NDK r7b were not configured properly, 1706 resulting in crashes on Tegra2-based devices and others when trying to use 1707 certain floating-point functions (e.g., {@code cosf}, {@code sinf}, {@code expf}).</li> 1708 </ul> 1709 </dd> 1710 1711 <dt>Important changes:</dt> 1712 1713 <dd> 1714 <ul> 1715 <li>Added support for custom output directories through the {@code NDK_OUT} 1716 environment variable. When defined, this variable is used to store all 1717 intermediate generated files, instead of {@code $PROJECT_PATH/obj}. The variable is 1718 also recognized by {@code ndk-gdb}. </li> 1719 <li>Added support for building modules with hundreds or even thousands of source 1720 files by defining {@code LOCAL_SHORT_COMMANDS} to {@code true} in your {@code Android.mk}. 1721 <p>This change forces the NDK build system to put most linker or archiver options 1722 into list files, as a work-around for command-line length limitations. 1723 See {@code docs/ANDROID-MK.html} for details.</p> 1724 </li> 1725 </ul> 1726 </dd> 1727 1728 <dt>Other bug fixes:</dt> 1729 1730 <dd> 1731 <ul> 1732 <li>Fixed {@code android_getCpuCount()} implementation in the {@code cpufeatures} 1733 helper library. On certain devices, where cores are enabled dynamically by the system, the previous 1734 implementation would report the total number of <em>active</em> cores the first time the function 1735 was called, rather than the total number of <em>physically available</em> cores.</li> 1736 </ul> 1737 </dd> 1738 </dl> 1739 </div> 1740 </div> 1741 1742 1743 <div class="toggle-content closed"> 1744 <p><a href="#" onclick="return toggleContent(this)"> 1745 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1746 alt="">Android NDK, Revision 7b</a> <em>(February 2012)</em> 1747 </p> 1748 1749 <div class="toggle-content-toggleme"> 1750 <p>This release of the NDK includes fixes for native Windows builds, Cygwin and many other 1751 improvements:</p> 1752 1753 <dl> 1754 <dt>Important bug fixes:</dt> 1755 1756 <dd> 1757 <ul> 1758 <li>Updated {@code sys/atomics.h} to avoid correctness issues 1759 on some multi-core ARM-based devices. Rebuild your unmodified sources with this 1760 version of the NDK and this problem should be completely eliminated. 1761 For more details, read {@code docs/ANDROID-ATOMICS.html}.</li> 1762 <li>Reverted to {@code binutils} 2.19 to fix debugging issues that 1763 appeared in NDK r7 (which switched to {@code binutils} 2.20.1).</li> 1764 <li>Fixed {@code ndk-build} on 32-bit Linux. A packaging error put a 64-bit version 1765 of the {@code awk} executable under {@code prebuilt/linux-x86/bin} in NDK r7.</li> 1766 <li>Fixed native Windows build ({@code ndk-build.cmd}). Other build modes were not 1767 affected. The fixes include: 1768 <ul> 1769 <li>Removed an infinite loop / stack overflow bug that happened when trying 1770 to call {@code ndk-build.cmd} from a directory that was <em>not</em> the top of 1771 your project path (e.g., in any sub-directory of it).</li> 1772 <li>Fixed a problem where the auto-generated dependency files were ignored. This 1773 meant that updating a header didn't trigger recompilation of sources that included 1774 it.</li> 1775 <li>Fixed a problem where special characters in files or paths, other than spaces and 1776 quotes, were not correctly handled.</li> 1777 </ul> 1778 </li> 1779 <li>Fixed the standalone toolchain to generate proper binaries when using 1780 {@code -lstdc++} (i.e., linking against the GNU {@code libstdc++} C++ runtime). You 1781 should use {@code -lgnustl_shared} if you want to link against the shared library 1782 version or {@code -lstdc++} for the static version. 1783 1784 <p>See {@code docs/STANDALONE-TOOLCHAIN.html} for more details about this fix.</p> 1785 </li> 1786 <li>Fixed {@code gnustl_shared} on Cygwin. The linker complained that it couldn't find 1787 {@code libsupc++.a} even though the file was at the right location.</li> 1788 <li>Fixed Cygwin C++ link when not using any specific C++ runtime through 1789 {@code APP_STL}.</li> 1790 </ul> 1791 </dd> 1792 </dl> 1793 1794 <dl> 1795 <dt>Other changes:</dt> 1796 1797 <dd> 1798 <ul> 1799 <li>When your application uses the GNU {@code libstdc++} runtime, the compiler will 1800 no longer forcibly enable exceptions and RTTI. This change results in smaller code. 1801 <p>If you need these features, you must do one of the following:</p> 1802 <ul> 1803 <li>Enable exceptions and/or RTTI explicitly in your modules or 1804 {@code Application.mk}. (recommended)</li> 1805 <li>Define {@code APP_GNUSTL_FORCE_CPP_FEATURES} to {@code 'exceptions'}, 1806 {@code 'rtti'} or both in your {@code Application.mk}. See 1807 {@code docs/APPLICATION-MK.html} for more details.</li> 1808 </ul> 1809 </li> 1810 <li>{@code ndk-gdb} now works properly when your application has private services 1811 running in independent processes. It debugs the main application process, instead of the 1812 first process listed by {@code ps}, which is usually a service process.</li> 1813 <li>Fixed a rare bug where NDK r7 would fail to honor the {@code LOCAL_ARM_MODE} value 1814 and always compile certain source files (but not all) to 32-bit instructions.</li> 1815 <li>{@code STLport}: Refresh the sources to match the Android platform version. This 1816 update fixes a few minor bugs: 1817 <ul> 1818 <li>Fixed instantiation of an incomplete type</li> 1819 <li>Fixed minor "==" versus "=" typo</li> 1820 <li>Used {@code memmove} instead of {@code memcpy} in {@code string::assign}</li> 1821 <li>Added better handling of {@code IsNANorINF}, {@code IsINF}, {@code IsNegNAN}, 1822 etc.</li> 1823 </ul> 1824 <p>For complete details, see the commit log.</p> 1825 </li> 1826 <li>{@code STLport}: Removed 5 unnecessary static initializers from the library.</li> 1827 <li>The GNU libstdc++ libraries for armeabi-v7a were mistakenly compiled for 1828 armeabi instead. This change had no impact on correctness, but using the right 1829 ABI should provide slightly better performance.</li> 1830 <li>The {@code cpu-features} helper library was updated to report three optional 1831 x86 CPU features ({@code SSSE3}, {@code MOVBE} and {@code POPCNT}). See 1832 {@code docs/CPU-FEATURES.html} for more details.</li> 1833 <li>{@code docs/NDK-BUILD.html} was updated to mention {@code NDK_APPLICATION_MK} instead 1834 of {@code NDK_APP_APPLICATION_MK} to select a custom {@code Application.mk} file.</li> 1835 <li>Cygwin: {@code ndk-build} no longer creates an empty "NUL" file in the current 1836 directory when invoked.</li> 1837 <li>Cygwin: Added better automatic dependency detection. In the previous version, it 1838 didn't work properly in the following cases: 1839 <ul> 1840 <li>When the Cygwin drive prefix was not {@code /cygdrive}.</li> 1841 <li>When using drive-less mounts, for example, when Cygwin would translate 1842 {@code /home} to {@code \\server\subdir} instead of {@code C:\Some\Dir}.</li> 1843 </ul> 1844 </li> 1845 <li>Cygwin: {@code ndk-build} does not try to use the native Windows tools under 1846 {@code $NDK/prebuilt/windows/bin} with certain versions of Cygwin and/or GNU Make.</li> 1847 </ul> 1848 </dd> 1849 </dl> 1850 </div> 1851 </div> 1852 1853 1854 <div class="toggle-content closed"> 1855 <p><a href="#" onclick="return toggleContent(this)"> 1856 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1857 alt="">Android NDK, Revision 7</a> <em>(November 2011)</em> 1858 </p> 1859 1860 <div class="toggle-content-toggleme"> 1861 <p>This release of the NDK includes new features to support the Android 4.0 platform as well 1862 as many other additions and improvements:</p> 1863 1864 <dl> 1865 <dt>New features</dt> 1866 1867 <dd> 1868 <ul> 1869 <li>Added official NDK APIs for Android 4.0 (API level 14), which adds the following 1870 native features to the platform: 1871 1872 <ul> 1873 <li>Added native multimedia API based on the Khronos Group OpenMAX AL? 1.0.1 1874 standard. The new <code><OMXAL/OpenMAXAL.h></code> and 1875 <code><OMXAL/OpenMAXAL_Android.h></code> headers allow applications targeting 1876 API level 14 to perform multimedia output directly from native code by using a new 1877 Android-specific buffer queue interface. For more details, see 1878 <code>docs/openmaxal/index.html</code> and <a href= 1879 "http://www.khronos.org/openmax/">http://www.khronos.org/openmax/</a>.</li> 1880 1881 <li>Updated the native audio API based on the Khronos Group OpenSL ES 1.0.1? 1882 standard. With API Level 14, you can now decode compressed audio (e.g. MP3, AAC, 1883 Vorbis) to PCM. For more details, see <code>docs/opensles/index.html</code> and 1884 <a href= 1885 "http://www.khronos.org/opensles">http://www.khronos.org/opensles/</a>.</li> 1886 </ul> 1887 </li> 1888 1889 <li>Added CCache support. To speed up large rebuilds, define the 1890 <code>NDK_CCACHE</code> environment variable to <code>ccache</code> (or the path to 1891 your <code>ccache</code> binary). When declared, the NDK build system automatically 1892 uses CCache when compiling any source file. For example: 1893 <pre> 1894 export NDK_CCACHE=ccache 1895 </pre> 1896 <p class="note"><strong>Note:</strong> CCache is not included in the NDK release 1897 so you must have it installed prior to using it. For more information about CCache, see 1898 <a href="http://ccache.samba.org">http://ccache.samba.org</a>.</p> 1899 </li> 1900 1901 <li>Added support for setting <code>APP_ABI</code> to <code>all</code> to indicate that 1902 you want to build your NDK modules for all the ABIs supported by your given NDK 1903 release. This means that either one of the following two lines in your 1904 <code>Application.mk</code> are equivalent with this release: 1905 <pre> 1906 APP_ABI := all 1907 APP_ABI := armeabi armeabi-v7a x86 1908 </pre> 1909 1910 <p>This also works if you define <code>APP_ABI</code> when calling 1911 <code>ndk-build</code> from the command-line, which is a quick way to check that your 1912 project builds for all supported ABIs without changing the project's 1913 <code>Application.mk file</code>. For example:</p> 1914 <pre> 1915 ndk-build APP_ABI=all 1916 </pre> 1917 </li> 1918 1919 <li>Added a <code>LOCAL_CPP_FEATURES</code> variable in <code>Android.mk</code> that 1920 allows you to declare which C++ features (RTTI or Exceptions) your module uses. This 1921 ensures that the final linking works correctly if you have prebuilt modules that depend 1922 on these features. See <code>docs/ANDROID-MK.html</code> and 1923 <code>docs/CPLUSPLUS-SUPPORT.html</code> for more details.</li> 1924 1925 <li>Shortened paths to source and object files that are used in build commands. When 1926 invoking <code>$NDK/ndk-build</code> from your project path, the paths to the source, 1927 object, and binary files that are passed to the build commands are significantly 1928 shorter now, because they are passed relative to the current directory. This is useful 1929 when building projects with a lot of source files, to avoid limits on the maximum 1930 command line length supported by your host operating system. The behavior is unchanged 1931 if you invoke <code>ndk-build</code> from a sub-directory of your project tree, or if 1932 you define <code>NDK_PROJECT_PATH</code> to point to a specific directory.</li> 1933 </ul> 1934 </dd> 1935 1936 <dt>Experimental features</dt> 1937 1938 <dd> 1939 You can now build your NDK source files on Windows <em>without</em> Cygwin by calling the 1940 <code>ndk-build.cmd</code> script from the command line from your project path. The 1941 script takes exactly the same arguments as the original <code>ndk-build</code> script. 1942 The Windows NDK package comes with its own prebuilt binaries for GNU Make, Awk and other 1943 tools required by the build. You should not need to install anything else to get a 1944 working build system. 1945 1946 <p class="caution"><strong>Important:</strong> <code>ndk-gdb</code> does not work on 1947 Windows, so you still need Cygwin to debug.</p> 1948 1949 <p>This feature is still experimental, so feel free to try it and report issues on the 1950 <a href="http://b.android.com">public bug database</a> or <a href= 1951 "http://groups.google.com/group/android-ndk">public forum</a>. All samples and unit tests 1952 shipped with the NDK succesfully compile with this feature.</p> 1953 </dd> 1954 1955 <dt>Important bug fixes</dt> 1956 1957 <dd> 1958 <ul> 1959 <li>Imported shared libraries are now installed by default to the target installation 1960 location (<code>libs/<abi></code>) if <code>APP_MODULES</code> is not defined in 1961 your <code>Application.mk</code>. For example, if a top-level module <code>foo</code> 1962 imports a module <code>bar</code>, then both <code>libfoo.so</code> and 1963 <code>libbar.so</code> are copied to the install location. Previously, only 1964 <code>libfoo.so</code> was copied, unless you listed <code>bar</code> in your 1965 <code>APP_MODULES</code> too. If you define <code>APP_MODULES</code> explicitly, the 1966 behavior is unchanged.</li> 1967 1968 <li><code>ndk-gdb</code> now works correctly for activities with multiple categories in 1969 their MAIN intent filters.</li> 1970 1971 <li>Static library imports are now properly transitive. For example, if a top-level 1972 module <code>foo</code> imports static library <code>bar</code> that imports static 1973 library <code>zoo</code>, the <code>libfoo.so</code> will now be linked against both 1974 <code>libbar.a</code> and <code>libzoo.a</code>.</li> 1975 </ul> 1976 </dd> 1977 1978 <dt>Other changes</dt> 1979 1980 <dd> 1981 <ul> 1982 <li><code>docs/NATIVE-ACTIVITY.HTML</code>: Fixed typo. The minimum API level should be 1983 9, not 8 for native activities.</li> 1984 1985 <li><code>docs/STABLE-APIS.html</code>: Added missing documentation listing EGL as a 1986 supported stable API, starting from API level 9.</li> 1987 1988 <li><code>download-toolchain-sources.sh</code>: Updated to download the toolchain 1989 sources from <a href="http://android.googlesource.com">android.googlesource.com</a>, 1990 which is the new location for the AOSP servers.</li> 1991 1992 <li>Added a new C++ support runtime named <code>gabi++</code>. More details about it 1993 are available in the updated <code>docs/CPLUSPLUS-SUPPORT.html</code>.</li> 1994 1995 <li>Added a new C++ support runtime named <code>gnustl_shared</code> that corresponds 1996 to the shared library version of GNU libstdc++ v3 (GPLv3 license). See more info at 1997 <code>docs/CPLUSPLUS-SUPPORT.html</code></li> 1998 1999 <li>Added support for RTTI in the STLport C++ runtimes (no support for 2000 exceptions).</li> 2001 2002 <li>Added support for multiple file extensions in <code>LOCAL_CPP_EXTENSION</code>. For 2003 example, to compile both <code>foo.cpp</code> and <code>bar.cxx</code> as C++ sources, 2004 declare the following: 2005 <pre> 2006 LOCAL_CPP_EXTENSION := .cpp .cxx 2007 </pre> 2008 </li> 2009 2010 <li>Removed many unwanted exported symbols from the link-time shared system libraries 2011 provided by the NDK. This ensures that code generated with the standalone toolchain 2012 doesn't risk to accidentally depend on a non-stable ABI symbol (e.g. any libgcc.a 2013 symbol that changes each time the toolchain used to build the platform is changed)</li> 2014 2015 <li>Refreshed the EGL and OpenGLES Khronos headers to support more extensions. Note 2016 that this does <em>not</em> change the NDK ABIs for the corresponding libraries, 2017 because each extension must be probed at runtime by the client application. 2018 2019 <p>The extensions that are available depend on your actual device and GPU drivers, 2020 not the platform version the device runs on. The header changes simply add new 2021 constants and types to make it easier to use the extensions when they have been 2022 probed with <code>eglGetProcAddress()</code> or <code>glGetProcAddress()</code>. The 2023 following list describes the newly supported extensions:</p> 2024 2025 <dl> 2026 <dt>GLES 1.x</dt> 2027 2028 <dd> 2029 <ul> 2030 <li><code>GL_OES_vertex_array_object</code></li> 2031 2032 <li><code>GL_OES_EGL_image_external</code></li> 2033 2034 <li><code>GL_APPLE_texture_2D_limited_npot</code></li> 2035 2036 <li><code>GL_EXT_blend_minmax</code></li> 2037 2038 <li><code>GL_EXT_discard_framebuffer</code></li> 2039 2040 <li><code>GL_EXT_multi_draw_arrays</code></li> 2041 2042 <li><code>GL_EXT_read_format_bgra</code></li> 2043 2044 <li><code>GL_EXT_texture_filter_anisotropic</code></li> 2045 2046 <li><code>GL_EXT_texture_format_BGRA8888</code></li> 2047 2048 <li><code>GL_EXT_texture_lod_bias</code></li> 2049 2050 <li><code>GL_IMG_read_format</code></li> 2051 2052 <li><code>GL_IMG_texture_compression_pvrtc</code></li> 2053 2054 <li><code>GL_IMG_texture_env_enhanced_fixed_function</code></li> 2055 2056 <li><code>GL_IMG_user_clip_plane</code></li> 2057 2058 <li><code>GL_IMG_multisampled_render_to_texture</code></li> 2059 2060 <li><code>GL_NV_fence</code></li> 2061 2062 <li><code>GL_QCOM_driver_control</code></li> 2063 2064 <li><code>GL_QCOM_extended_get</code></li> 2065 2066 <li><code>GL_QCOM_extended_get2</code></li> 2067 2068 <li><code>GL_QCOM_perfmon_global_mode</code></li> 2069 2070 <li><code>GL_QCOM_writeonly_rendering</code></li> 2071 2072 <li><code>GL_QCOM_tiled_rendering</code></li> 2073 </ul> 2074 </dd> 2075 2076 <dt>GLES 2.0</dt> 2077 2078 <dd> 2079 <ul> 2080 <li><code>GL_OES_element_index_uint</code></li> 2081 2082 <li><code>GL_OES_get_program_binary</code></li> 2083 2084 <li><code>GL_OES_mapbuffer</code></li> 2085 2086 <li><code>GL_OES_packed_depth_stencil</code></li> 2087 2088 <li><code>GL_OES_texture_3D</code></li> 2089 2090 <li><code>GL_OES_texture_float</code></li> 2091 2092 <li><code>GL_OES_texture_float_linear</code></li> 2093 2094 <li><code>GL_OES_texture_half_float_linear</code></li> 2095 2096 <li><code>GL_OES_texture_npot</code></li> 2097 2098 <li><code>GL_OES_vertex_array_object</code></li> 2099 2100 <li><code>GL_OES_EGL_image_external</code></li> 2101 2102 <li><code>GL_AMD_program_binary_Z400</code></li> 2103 2104 <li><code>GL_EXT_blend_minmax</code></li> 2105 2106 <li><code>GL_EXT_discard_framebuffer</code></li> 2107 2108 <li><code>GL_EXT_multi_draw_arrays</code></li> 2109 2110 <li><code>GL_EXT_read_format_bgra</code></li> 2111 2112 <li><code>GL_EXT_texture_format_BGRA8888</code></li> 2113 2114 <li><code>GL_EXT_texture_compression_dxt1</code></li> 2115 2116 <li><code>GL_IMG_program_binary</code></li> 2117 2118 <li><code>GL_IMG_read_format</code></li> 2119 2120 <li><code>GL_IMG_shader_binary</code></li> 2121 2122 <li><code>GL_IMG_texture_compression_pvrtc</code></li> 2123 2124 <li><code>GL_IMG_multisampled_render_to_texture</code></li> 2125 2126 <li><code>GL_NV_coverage_sample</code></li> 2127 2128 <li><code>GL_NV_depth_nonlinear</code></li> 2129 2130 <li><code>GL_QCOM_extended_get</code></li> 2131 2132 <li><code>GL_QCOM_extended_get2</code></li> 2133 2134 <li><code>GL_QCOM_writeonly_rendering</code></li> 2135 2136 <li><code>GL_QCOM_tiled_rendering</code></li> 2137 </ul> 2138 </dd> 2139 2140 <dt>EGL</dt> 2141 2142 <dd> 2143 <ul> 2144 <li><code>EGL_ANDROID_recordable</code></li> 2145 2146 <li><code>EGL_NV_system_time</code></li> 2147 </ul> 2148 </dd> 2149 </dl> 2150 </li> 2151 </ul> 2152 </dd> 2153 </dl> 2154 </div> 2155 </div> 2156 2157 2158 <div class="toggle-content closed"> 2159 <p><a href="#" onclick="return toggleContent(this)"> 2160 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2161 alt="">Android NDK, Revision 6b</a> <em>(August 2011)</em> 2162 </p> 2163 2164 <div class="toggle-content-toggleme"> 2165 <p>This release of the NDK does not include any new features compared to r6. The r6b release 2166 addresses the following issues in the r6 release:</p> 2167 <dl> 2168 <dt>Important bug fixes</dt> 2169 <dd> 2170 <ul> 2171 <li>Fixed the build when <code>APP_ABI="armeabi x86"</code> is used for 2172 multi-architecture builds.</li> 2173 <li>Fixed the location of prebuilt STLport binaries in the NDK release package. 2174 A bug in the packaging script placed them in the wrong location.</li> 2175 <li>Fixed <code>atexit()</code> usage in shared libraries with the x86standalone 2176 toolchain.</li> 2177 <li>Fixed <code>make-standalone-toolchain.sh --arch=x86</code>. It used to fail 2178 to copy the proper GNU libstdc++ binaries to the right location.</li> 2179 <li>Fixed the standalone toolchain linker warnings about missing the definition and 2180 size for the <code>__dso_handle</code> symbol (ARM only).</li> 2181 <li>Fixed the inclusion order of <code>$(SYSROOT)/usr/include</code> for x86 builds. 2182 See the <a href="http://b.android.com/18540">bug</a> for 2183 more information.</li> 2184 <li>Fixed the definitions of <code>ptrdiff_t</code> and <code>size_t</code> in 2185 x86-specific systems when they are used with the x86 standalone toolchain.</li> 2186 </ul> 2187 </dd> 2188 </dl> 2189 </div> 2190 </div> 2191 2192 <div class="toggle-content closed"> 2193 <p><a href="#" onclick="return toggleContent(this)"> 2194 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2195 alt="">Android NDK, Revision 6</a> <em>(July 2011)</em> 2196 </p> 2197 2198 <div class="toggle-content-toggleme"> 2199 <p>This release of the NDK includes support for the x86 ABI and other minor changes. 2200 For detailed information describing the changes in this release, read the 2201 <code>CHANGES.HTML</code> document included in the NDK package. 2202 </p> 2203 <dl> 2204 <dt>General notes:</dt> 2205 <dd> 2206 <ul> 2207 <li>Adds support for the x86 ABI, which allows you to generate machine code 2208 that runs on compatible x86-based Android devices. Major features for x86 2209 include x86-specific toolchains, system headers, libraries and 2210 debugging support. For all of the details regarding x86 support, 2211 see <code>docs/CPU-X86.html</code> in the NDK package. 2212 2213 <p>By default, code is generated for ARM-based devices, but you can add x86 to your 2214 <code>APP_ABI</code> definition in your <code>Application.mk</code> file to build 2215 for x86 platforms. For example, the following line instructs <code>ndk-build</code> 2216 to build your code for three distinct ABIs:</p> 2217 2218 <pre>APP_ABI := armeabi armeabi-v7a x86</pre> 2219 2220 <p>Unless you rely on ARM-based assembly sources, you shouldn't need to touch 2221 your <code>Android.mk</code> files to build x86 machine code.</p> 2222 2223 </li> 2224 2225 <li>You can build a standalone x86 toolchain using the <code>--toolchain=x86-4.4.3</code> 2226 option when calling <code>make-standalone-toolchain.sh</code>. See 2227 <code>docs/STANDALONE-TOOLCHAIN.html</code> for more details. 2228 </li> 2229 <li>The new <code>ndk-stack</code> tool lets you translate stack traces in 2230 <code>logcat</code> that are generated by native code. The tool translates 2231 instruction addresses into a readable format that contains things such 2232 as the function, source file, and line number corresponding to each stack frame. 2233 For more information and a usage example, see <code>docs/NDK-STACK.html</code>. 2234 </li> 2235 </ul> 2236 </dd> 2237 <dt>Other changes:</dt> 2238 <dd><code>arm-eabi-4.4.0</code>, which had been deprecated since NDK r5, has been 2239 removed from the NDK distribution.</dd> 2240 2241 </dl> 2242 </div> 2243 </div> 2244 2245 <div class="toggle-content closed"> 2246 <p><a href="#" onclick="return toggleContent(this)"> 2247 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2248 alt="">Android NDK, Revision 5c</a> <em>(June 2011)</em> 2249 </p> 2250 2251 <div class="toggle-content-toggleme"> 2252 <p>This release of the NDK does not include any new features compared to r5b. The r5c release 2253 addresses the following problems in the r5b release:</p> 2254 <dl> 2255 <dt>Important bug fixes:</dt> 2256 <dd> 2257 <ul> 2258 <li><code>ndk-build</code>: Fixed a rare bug that appeared when trying to perform parallel 2259 builds of debuggable projects.</li> 2260 2261 <li>Fixed a typo that prevented <code>LOCAL_WHOLE_STATIC_LIBRARIES</code> to work 2262 correctly with the new toolchain and added documentation for this in 2263 <code>docs/ANDROID-MK.html</code>.</li> 2264 2265 <li>Fixed a bug where code linked against <code>gnustl_static</code> crashed when run on 2266 platform releases older than API level 8 (Android 2.2).</li> 2267 2268 <li><code>ndk-gdb</code>: Fixed a bug that caused a segmentation fault when debugging Android 3.0 2269 or newer devices.</li> 2270 2271 <li><code><android/input.h></code>: Two functions that were introduced in API level 2272 9 (Android 2.3) were incorrect and are fixed. While this breaks the source API, the 2273 binary interface to the system is unchanged. The incorrect functions were missing a 2274 <code>history_index</code> parameter, and the correct definitions are shown below: 2275 <pre> 2276 float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, 2277 size_t pointer_index, 2278 size_t history_index); 2279 2280 float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, 2281 size_t pointer_index, 2282 size_t history_index); 2283 </pre> 2284 </li> 2285 2286 <li>Updated the C library ARM binary for API level 9 (Android 2.3) to correctly expose at 2287 link time new functions that were added in that API level (for example, 2288 <code>pthread_rwlock_init</code>).</li> 2289 2290 </ul> 2291 </dd> 2292 2293 <dt>Minor improvements and fixes:</dt> 2294 <dd> 2295 <ul> 2296 <li>Object files are now always linked in the order they appear in 2297 <code>LOCAL_SRC_FILES</code>. This was not the case previously because the files were 2298 grouped by source extensions instead.</li> 2299 2300 <li>When <code>import-module</code> fails, it now prints the list of directories that 2301 were searched. This is useful to check that the <code>NDK_MODULE_PATH</code> definition 2302 used by the build system is correct.</li> 2303 2304 <li>When <code>import-module</code> succeeds, it now prints the directory where the 2305 module was found to the log (visible with <code>NDK_LOG=1</code>).</li> 2306 2307 <li>Increased the build speed of debuggable applications when there is a very large number 2308 of include directories in the project.</li> 2309 2310 <li><code>ndk-gdb</code>: Better detection of <code>adb shell</code> failures and improved 2311 error messages.</li> 2312 2313 <li><code><pthread.h></code>: Fixed the definition of 2314 <code>PTHREAD_RWLOCK_INITIALIZER</code> for API level 9 (Android 2.3) and higher.</li> 2315 2316 <li>Fixed an issue where a module could import itself, resulting in an infinite loop in 2317 GNU Make.</li> 2318 2319 <li>Fixed a bug that caused the build to fail if <code>LOCAL_ARM_NEON</code> was set to 2320 true (typo in <code>build/core/build-binary.mk</code>).</li> 2321 2322 <li>Fixed a bug that prevented the compilation of <code>.s</code> assembly files 2323 (<code>.S</code> files were okay).</li> 2324 </ul> 2325 </dd> 2326 </dl> 2327 </div> 2328 </div> 2329 2330 <div class="toggle-content closed"> 2331 <p><a href="#" onclick="return toggleContent(this)"> 2332 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2333 alt="">Android NDK, Revision 5b</a> <em>(January 2011)</em> 2334 </p> 2335 2336 <div class="toggle-content-toggleme"> 2337 <p>This release of the NDK does not include any new features compared to r5. The r5b release addresses the 2338 following problems in the r5 release: 2339 </p> 2340 <ul> 2341 <li>The r5 binaries required glibc 2.11, but the r5b binaries are generated with a special 2342 toolchain that targets glibc 2.7 or higher instead. The Linux toolchain binaries now run on Ubuntu 8.04 or higher. </li> 2343 <li>Fixes a compiler bug in the arm-linux-androideabi-4.4.3 toolchain. 2344 The previous binary generated invalid thumb instruction sequences when 2345 dealing with signed chars.</li> 2346 <li>Adds missing documentation for the 2347 "gnustl_static" value for APP_STL, that allows you to link against 2348 a static library version of GNU libstdc++. </li> 2349 <li>The following <code>ndk-build</code> issues are fixed: 2350 <ul> 2351 <li>A bug that created inconsistent dependency files when a 2352 compilation error occured on Windows. This prevented a proper build after 2353 the error was fixed in the source code.</li> 2354 <li>A Cygwin-specific bug where using very short paths for 2355 the Android NDK installation or the project path led to the 2356 generation of invalid dependency files. This made incremental builds 2357 impossible.</li> 2358 <li>A typo that prevented the cpufeatures library from working correctly 2359 with the new NDK toolchain.</li> 2360 <li>Builds in Cygwin are faster by avoiding calls to <code>cygpath -m</code> 2361 from GNU Make for every source or object file, which caused problems 2362 with very large source trees. In case this doesn't work properly, define <code>NDK_USE_CYGPATH=1</code> in your 2363 environment to use <code>cygpath -m</code> again.</li> 2364 <li>The Cygwin installation now notifies the user of invalid installation paths that contain spaces. Previously, an invalid path 2365 would output an error that complained about an incorrect version of GNU Make, even if the right one was installed. 2366 </ul> 2367 </li> 2368 <li>Fixed a typo that prevented the <code>NDK_MODULE_PATH</code> environment variable from working properly when 2369 it contained multiple directories separated with a colon. </li> 2370 <li>The <code>prebuilt-common.sh</code> script contains fixes to check the compiler for 64-bit 2371 generated machine code, instead of relying on the host tag, which 2372 allows the 32-bit toolchain to rebuild properly on Snow Leopard. The toolchain rebuild scripts now also support 2373 using a 32-bit host toolchain.</li> 2374 <li>A missing declaration for <code>INET_ADDRSTRLEN</code> was added to <code><netinet/in.h></code>.</li> 2375 <li>Missing declarations for <code>IN6_IS_ADDR_MC_NODELOCAL</code> and <code>IN6_IS_ADDR_MC_GLOBAL</code> were added to <code><netinet/in6.h></code>.</li> 2376 <li>'asm' was replaced with '__asm__' in <code><asm/byteorder.h></code> to allow compilation with <code>-std=c99</code>.</li> 2377 </ul> 2378 </div> 2379 </div> 2380 2381 <div class="toggle-content closed"> 2382 <p><a href="#" onclick="return toggleContent(this)"> 2383 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2384 alt="">Android NDK, Revision 5</a> <em>(December 2010)</em> 2385 </p> 2386 2387 <div class="toggle-content-toggleme"> 2388 <p>This release of the NDK includes many new APIs, most of which are introduced to 2389 support the development of games and similar applications that make extensive use 2390 of native code. Using the APIs, developers have direct native access to events, audio, 2391 graphics and window management, assets, and storage. Developers can also implement the 2392 Android application lifecycle in native code with help from the new 2393 {@link android.app.NativeActivity} class. For detailed information describing the changes in this 2394 release, read the <code>CHANGES.HTML</code> document included in the downloaded NDK package. 2395 </p> 2396 <dl> 2397 <dt>General notes:</dt> 2398 <dd> 2399 <ul> 2400 <li>Adds support for native activities, which allows you to implement the 2401 Android application lifecycle in native code.</li> 2402 2403 <li>Adds native support for the following: 2404 2405 <ul> 2406 2407 <li>Input subsystem (such as the keyboard and touch screen)</li> 2408 2409 <li>Access to sensor data (accelerometer, compass, gyroscope, etc).</li> 2410 2411 <li>Event loop APIs to wait for things such as input and sensor events.</li> 2412 2413 <li>Window and surface subsystem</li> 2414 2415 <li>Audio APIs based on the OpenSL ES standard that support playback and recording 2416 as well as control over platform audio effects</li> 2417 2418 <li>Access to assets packaged in an <code>.apk</code> file.</li> 2419 2420 </ul> 2421 </li> 2422 2423 <li>Includes a new toolchain (based on GCC 4.4.3), which generates better code, and can also now 2424 be used as a standalone cross-compiler, for people who want to build their stuff with 2425 <code>./configure && make</code>. See 2426 docs/STANDALONE-TOOLCHAIN.html for the details. The binaries for GCC 4.4.0 are still provided, 2427 but the 4.2.1 binaries were removed.</li> 2428 2429 <li>Adds support for prebuilt static and shared libraries (docs/PREBUILTS.html) and module 2430 exports and imports to make sharing and reuse of third-party modules much easier 2431 (docs/IMPORT-MODULE.html explains why).</li> 2432 2433 <li>Provides a default C++ STL implementation (based on STLport) as a helper module. It can be used either 2434 as a static or shared library (details and usage examples are in sources/android/stlport/README). Prebuilt 2435 binaries for STLport (static or shared) and GNU libstdc++ (static only) are also provided if you choose to 2436 compile against those libraries instead of the default C++ STL implementation. 2437 C++ Exceptions and RTTI are not supported in the default STL implementation. For more information, see 2438 docs/CPLUSPLUS-SUPPORT.HTML.</li> 2439 2440 <li>Includes improvements to the <code>cpufeatures</code> helper library that improves reporting 2441 of the CPU type (some devices previously reported ARMv7 CPU when the device really was an ARMv6). We 2442 recommend developers that use this library to rebuild their applications then 2443 upload to Google Play to benefit from the improvements.</li> 2444 2445 <li>Adds an EGL library that lets you create and manage OpenGL ES textures and 2446 services.</li> 2447 2448 <li>Adds new sample applications, <code>native-plasma</code> and <code>native-activity</code>, 2449 to demonstrate how to write a native activity.</li> 2450 2451 <li>Includes many bugfixes and other small improvements; see docs/CHANGES.html for a more 2452 detailed list of changes.</li> 2453 </ul> 2454 </dd> 2455 </dl> 2456 </div> 2457 </div> 2458 2459 <div class="toggle-content closed"> 2460 <p><a href="#" onclick="return toggleContent(this)"> 2461 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2462 alt="">Android NDK, Revision 4b</a> <em>(June 2010)</em> 2463 </p> 2464 2465 <div class="toggle-content-toggleme"> 2466 <dl> 2467 <dt>NDK r4b notes:</dt> 2468 2469 <dd> 2470 <p>Includes fixes for several issues in the NDK build and debugging scripts — if 2471 you are using NDK r4, we recommend downloading the NDK r4b build. For detailed 2472 information describing the changes in this release, read the CHANGES.TXT document 2473 included in the downloaded NDK package.</p> 2474 </dd> 2475 </dl> 2476 2477 <dl> 2478 <dt>General notes:</dt> 2479 2480 <dd> 2481 <ul> 2482 <li>Provides a simplified build system through the new <code>ndk-build</code> build 2483 command.</li> 2484 2485 <li>Adds support for easy native debugging of generated machine code on production 2486 devices through the new <code>ndk-gdb</code> command.</li> 2487 2488 <li>Adds a new Android-specific ABI for ARM-based CPU architectures, 2489 <code>armeabi-v7a</code>. The new ABI extends the existing <code>armeabi</code> ABI to 2490 include these CPU instruction set extensions: 2491 2492 <ul> 2493 <li>Thumb-2 instructions</li> 2494 2495 <li>VFP hardware FPU instructions (VFPv3-D16)</li> 2496 2497 <li>Optional support for ARM Advanced SIMD (NEON) GCC intrinsics and VFPv3-D32. 2498 Supported by devices such as Verizon Droid by Motorola, Google Nexus One, and 2499 others.</li> 2500 </ul> 2501 </li> 2502 2503 <li>Adds a new <code>cpufeatures</code> static library (with sources) that lets your 2504 app detect the host device's CPU features at runtime. Specifically, applications can 2505 check for ARMv7-A support, as well as VFPv3-D32 and NEON support, then provide separate 2506 code paths as needed.</li> 2507 2508 <li>Adds a sample application, <code>hello-neon</code>, that illustrates how to use the 2509 <code>cpufeatures</code> library to check CPU features and then provide an optimized 2510 code path using NEON instrinsics, if supported by the CPU.</li> 2511 2512 <li>Lets you generate machine code for either or both of the instruction sets supported 2513 by the NDK. For example, you can build for both ARMv5 and ARMv7-A architectures at the 2514 same time and have everything stored to your application's final 2515 <code>.apk</code>.</li> 2516 2517 <li>To ensure that your applications are available to users only if their devices are 2518 capable of running them, Google Play now filters applications based on the 2519 instruction set information included in your application — no action is needed on 2520 your part to enable the filtering. Additionally, the Android system itself also checks 2521 your application at install time and allows the installation to continue only if the 2522 application provides a library that is compiled for the device's CPU architecture.</li> 2523 2524 <li>Adds support for Android 2.2, including a new stable API for accessing the pixel 2525 buffers of {@link android.graphics.Bitmap} objects from native code.</li> 2526 </ul> 2527 </dd> 2528 </dl> 2529 </div> 2530 </div> 2531 2532 <div class="toggle-content closed"> 2533 <p><a href="#" onclick="return toggleContent(this)"> 2534 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2535 alt="">Android NDK, Revision 3</a> <em>(March 2010)</em> 2536 </p> 2537 2538 <div class="toggle-content-toggleme"> 2539 <dl> 2540 <dt>General notes:</dt> 2541 2542 <dd> 2543 <ul> 2544 <li>Adds OpenGL ES 2.0 native library support.</li> 2545 2546 <li>Adds a sample application,<code>hello-gl2</code>, that illustrates the use of 2547 OpenGL ES 2.0 vertex and fragment shaders.</li> 2548 2549 <li>The toolchain binaries have been refreshed for this release with GCC 4.4.0, which 2550 should generate slightly more compact and efficient machine code than the previous one 2551 (4.2.1). The NDK also still provides the 4.2.1 binaries, which you can optionally use 2552 to build your machine code.</li> 2553 </ul> 2554 </dd> 2555 </dl> 2556 </div> 2557 </div> 2558 2559 <div class="toggle-content closed"> 2560 <p><a href="#" onclick="return toggleContent(this)"> 2561 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2562 alt="">Android NDK, Revision 2</a> <em>(September 2009)</em> 2563 </p> 2564 2565 <div class="toggle-content-toggleme"> 2566 <p>Originally released as "Android 1.6 NDK, Release 1".</p> 2567 2568 <dl> 2569 <dt>General notes:</dt> 2570 2571 <dd> 2572 <ul> 2573 <li>Adds OpenGL ES 1.1 native library support.</li> 2574 2575 <li>Adds a sample application, <code>san-angeles</code>, that renders 3D graphics 2576 through the native OpenGL ES APIs, while managing activity lifecycle with a {@link 2577 android.opengl.GLSurfaceView} object.</li> 2578 </ul> 2579 </dd> 2580 </dl> 2581 </div> 2582 </div> 2583 2584 <div class="toggle-content closed"> 2585 <p><a href="#" onclick="return toggleContent(this)"> 2586 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2587 alt="">Android NDK, Revision 1</a> <em>(June 2009)</em> 2588 </p> 2589 2590 <div class="toggle-content-toggleme"> 2591 <p>Originally released as "Android 1.5 NDK, Release 1".</p> 2592 2593 <dl> 2594 <dt>General notes:</dt> 2595 2596 <dd> 2597 <ul> 2598 <li>Includes compiler support (GCC) for ARMv5TE instructions, including Thumb-1 2599 instructions.</li> 2600 2601 <li>Includes system headers for stable native APIs, documentation, and sample 2602 applications.</li> 2603 </ul> 2604 </dd> 2605 </dl> 2606 </div> 2607 </div> 2608 2609 2610 2611 2612 2613 <!-- ####################### END OF RELEASE NOTES ####################### --> 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 <h2 id="Reqs">System and Software Requirements</h2> 2643 2644 <p>The sections below describe the system and software requirements for using the Android NDK, as 2645 well as platform compatibility considerations that affect appplications using libraries produced 2646 with the NDK.</p> 2647 2648 <h4>The Android SDK</h4> 2649 2650 <ul> 2651 <li>A complete Android SDK installation (including all dependencies) is required.</li> 2652 2653 <li>Android 1.5 SDK or later version is required.</li> 2654 </ul> 2655 2656 <h4>Supported operating systems</h4> 2657 2658 <ul> 2659 <li>Windows XP (32-bit) or Vista (32- or 64-bit)</li> 2660 2661 <li>Mac OS X 10.4.8 or later (x86 only)</li> 2662 2663 <li>Linux (32 or 64-bit; Ubuntu 8.04, or other Linux distributions using GLibc 2.7 or 2664 later)</li> 2665 </ul> 2666 2667 <h4>Required development tools</h4> 2668 2669 <ul> 2670 <li>For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU 2671 Make might work but have not been tested.</li> 2672 2673 <li>A recent version of awk (either GNU Awk or Nawk) is also required.</li> 2674 2675 <li>For Windows, <a href="http://www.cygwin.com">Cygwin</a> 1.7 or higher is required. The NDK 2676 will <em>not</em> work with Cygwin 1.5 installations.</li> 2677 </ul> 2678 2679 <h4 id="platform-compat">Android platform compatibility</h4> 2680 2681 <ul> 2682 <li>The native libraries created by the Android NDK can only be used on devices running 2683 specific minimum Android platform versions. The minimum required platform version depends on 2684 the CPU architecture of the devices you are targeting. The following table details which 2685 Android platform versions are compatible with native code developed for specific CPU 2686 architectures. 2687 2688 <table style="margin:1em;"> 2689 <tr> 2690 <th>Native Code CPU Architecture Used</th> 2691 <th>Compatible Android Platform(s)</th> 2692 </tr> 2693 2694 <tr> 2695 <td>ARM, ARM-NEON</td> 2696 <td>Android 1.5 (API Level 3) and higher</td> 2697 </tr> 2698 2699 <tr> 2700 <td>x86</td> 2701 <td>Android 2.3 (API Level 9) and higher</td> 2702 </tr> 2703 2704 <tr> 2705 <td>MIPS</td> 2706 <td>Android 2.3 (API Level 9) and higher</td> 2707 </tr> 2708 </table> 2709 2710 <p>These requirements mean you can use native libraries produced with the NDK in 2711 applications that are deployable to ARM-based devices running Android 1.5 or later. If you are 2712 deploying native libraries to x86 and MIPS-based devices, your application must target Android 2713 2.3 or later.</p> 2714 </li> 2715 2716 <li>To ensure compatibility, an application using a native library produced with the NDK 2717 <em>must</em> declare a <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code> 2718 <uses-sdk></code></a> element in its manifest file, with an 2719 <code>android:minSdkVersion</code> attribute value of "3" or higher. For example: 2720 2721 <pre style="margin:1em;"> 2722 <manifest> 2723 <uses-sdk android:minSdkVersion="3" /> 2724 ... 2725 </manifest> 2726 </pre> 2727 </li> 2728 2729 <li>If you use this NDK to create a native library that uses the OpenGL ES APIs, the 2730 application containing the library can be deployed only to devices running the minimum platform 2731 versions described in the table below. To ensure compatibility, make sure that your application 2732 declares the proper <code>android:minSdkVersion</code> attribute value, as shown in the 2733 following table.</li> 2734 2735 <li style="list-style: none; display: inline"> 2736 <table style="margin:1em;"> 2737 <tr> 2738 <th>OpenGL ES Version Used</th> 2739 2740 <th>Compatible Android Platform(s)</th> 2741 2742 <th>Required uses-sdk Attribute</th> 2743 </tr> 2744 2745 <tr> 2746 <td>OpenGL ES 1.1</td> 2747 2748 <td>Android 1.6 (API Level 4) and higher</td> 2749 2750 <td><code>android:minSdkVersion="4"</code></td> 2751 </tr> 2752 2753 <tr> 2754 <td>OpenGL ES 2.0</td> 2755 2756 <td>Android 2.0 (API Level 5) and higher</td> 2757 2758 <td><code>android:minSdkVersion="5"</code></td> 2759 </tr> 2760 </table> 2761 2762 <p>For more information about API Level and its relationship to Android platform versions, 2763 see <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">Android API Levels</a>.</p> 2764 </li> 2765 2766 <li>Additionally, an application using the OpenGL ES APIs should declare a 2767 <code><uses-feature></code> element in its manifest, with an 2768 <code>android:glEsVersion</code> attribute that specifies the minimum OpenGl ES version 2769 required by the application. This ensures that Google Play will show your application only 2770 to users whose devices are capable of supporting your application. For example: 2771 <pre style="margin:1em;"> 2772 <manifest> 2773 <!-- Declare that the application uses the OpenGL ES 2.0 API and is designed 2774 to run only on devices that support OpenGL ES 2.0 or higher. --> 2775 <uses-feature android:glEsVersion="0x00020000" /> 2776 ... 2777 </manifest> 2778 </pre> 2779 2780 <p>For more information, see the <a href= 2781 "{@docRoot}guide/topics/manifest/uses-feature-element.html"><code><uses-feature></code></a> 2782 documentation.</p> 2783 </li> 2784 2785 <li>If you use this NDK to create a native library that uses the API to access Android {@link 2786 android.graphics.Bitmap} pixel buffers or utilizes native activities, the application 2787 containing the library can be deployed only to devices running Android 2.2 (API level 8) or 2788 higher. To ensure compatibility, make sure that your application declares <code><uses-sdk 2789 android:minSdkVersion="8" /></code> attribute value in its manifest.</li> 2790 </ul> 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 <h2 id="Installing">Installing the NDK</h2> 2819 <p>Installing the NDK on your development computer is straightforward and involves extracting the 2820 NDK from its download package.</p> 2821 2822 <p>Before you get started make sure that you have downloaded the latest <a href= 2823 "{@docRoot}sdk/index.html">Android SDK</a> and upgraded your applications and environment as 2824 needed. The NDK is compatible with older platform versions but not older versions of the SDK tools. 2825 Also, take a moment to review the <a href="{@docRoot}tools/sdk/ndk/overview.html#reqs">System and 2826 Software Requirements</a> 2827 for the NDK, if you haven't already.</p> 2828 2829 <p>To install the NDK, follow these steps:</p> 2830 2831 <ol> 2832 <li>From the table at the top of this page, select the NDK package that is appropriate for your 2833 development computer and download the package.</li> 2834 2835 <li>Uncompress the NDK download package using tools available on your computer. When 2836 uncompressed, the NDK files are contained in a directory called 2837 <code>android-ndk-<version></code>. You can rename the NDK directory if necessary and you 2838 can move it to any location on your computer. This documentation refers to the NDK directory as 2839 <code><ndk></code>.</li> 2840 </ol> 2841 2842 <p>You are now ready to start working with the NDK.</p> 2843 2844 2845 <h2 id="GetStarted">Getting Started with the NDK</h2> 2846 2847 <p>Once you've installed the NDK successfully, take a few minutes to read the documentation 2848 included in the NDK. You can find the documentation in the <code><ndk>/docs/</code> 2849 directory. In particular, please read the OVERVIEW.HTML document completely, so that you 2850 understand the intent of the NDK and how to use it.</p> 2851 2852 <p>If you used a previous version of the NDK, take a moment to review the list of NDK changes in 2853 the CHANGES.HTML document.</p> 2854 2855 <p>Here's the general outline of how you work with the NDK tools:</p> 2856 2857 <ol> 2858 <li>Place your native sources under <code><project>/jni/...</code></li> 2859 2860 <li>Create <code><project>/jni/Android.mk</code> to describe your native sources to the 2861 NDK build system</li> 2862 2863 <li>Optional: Create <code><project>/jni/Application.mk</code>.</li> 2864 2865 <li>Build your native code by running the 'ndk-build' script from your project's directory. It 2866 is located in the top-level NDK directory: 2867 <pre class="no-pretty-print">cd <project> 2868 <ndk>/ndk-build 2869 </pre> 2870 2871 <p>The build tools copy the stripped, shared libraries needed by your application to the 2872 proper location in the application's project directory.</p> 2873 </li> 2874 2875 <li>Finally, compile your application using the SDK tools in the usual way. The SDK build tools 2876 will package the shared libraries in the application's deployable <code>.apk</code> file.</li> 2877 </ol> 2878 2879 <p>For complete information on all of the steps listed above, please see the documentation 2880 included with the NDK package.</p> 2881 2882 2883 <h3 id="Using">Using the NDK</h3> 2884 2885 <p>The Android framework provides two ways to use native code:</p> 2886 2887 <ul> 2888 <li>Write your application using the Android framework and use JNI to access the APIs provided 2889 by the Android NDK. This technique allows you to take advantage of the convenience of the 2890 Android framework, but still allows you to write native code when necessary. If you use this 2891 approach, your application must target specific, minimum Android platform levels, see <a 2892 href="#platform-compat">Android platform compatibility</a> for more information.</li> 2893 2894 <li> 2895 <p>Write a native activity, which allows you to implement the lifecycle callbacks in native 2896 code. The Android SDK provides the {@link android.app.NativeActivity} class, which is a 2897 convenience class that notifies your 2898 native code of any activity lifecycle callbacks (<code>onCreate()</code>, <code>onPause()</code>, 2899 <code>onResume()</code>, etc). You can implement the callbacks in your native code to handle 2900 these events when they occur. Applications that use native activities must be run on Android 2901 2.3 (API Level 9) or later.</p> 2902 2903 <p>You cannot access features such as Services and Content Providers natively, so if you want 2904 to use them or any other framework API, you can still write JNI code to do so.</p> 2905 </li> 2906 </ul> 2907 2908 2909 2910 2911 2912 <h2 id="Contents">Contents of the NDK</h2> 2913 2914 <p>The NDK contains the APIs, documentation, and sample 2915 applications that help you write your native code. Specifically:</p> 2916 2917 <ul> 2918 <li>A set of tools and build files used to generate native code libraries from C and C++ 2919 sources</li> 2920 2921 <li>A way to embed the corresponding native libraries into an application package file 2922 (<code>.apk</code>) that can be deployed on Android devices</li> 2923 2924 <li>A set of native system headers and libraries that will be supported in all future versions 2925 of the Android platform, starting from Android 1.5. Applications that use native activities 2926 must be run on Android 2.3 or later.</li> 2927 2928 <li>Documentation, samples, and tutorials</li> 2929 </ul> 2930 2931 <p>The latest release of the NDK supports the following instruction sets:</p> 2932 2933 <ul> 2934 <li>ARMv5TE, including Thumb-1 instructions (see {@code docs/CPU-ARCH-ABIS.html} for more 2935 information)</li> 2936 2937 <li>ARMv7-A, including Thumb-2 and VFPv3-D16 instructions, with optional support for 2938 NEON/VFPv3-D32 instructions (see {@code docs/CPU-ARM-NEON.html} for more information)</li> 2939 2940 <li>x86 instructions (see {@code docs/CPU-X86.html} for more information)</li> 2941 2942 <li>MIPS instructions (see {@code docs/CPU-MIPS.html} for more information)</li> 2943 </ul> 2944 2945 <p>ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on 2946 devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main 2947 difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and 2948 NEON instructions. You can target either or both of the instruction sets — ARMv5TE is the 2949 default, but switching to ARMv7-A is as easy as adding a single line to the application's 2950 <code>Application.mk</code> file, without needing to change anything else in the file. You can also build for 2951 both architectures at the same time and have everything stored in the final <code>.apk</code>. 2952 Complete information is provided in the CPU-ARCH-ABIS.HTML in the NDK package.</p> 2953 2954 <p>The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES 2955 (3D graphics library), the JNI interface, and other libraries, as listed in the <a href= 2956 "#Tools">Development tools</a> section.</p> 2957 2958 2959 <h3 id="Tools">Development tools</h3> 2960 2961 <p>The NDK includes a set of cross-toolchains (compilers, linkers, etc..) that can generate 2962 native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms.</p> 2963 2964 <p>It provides a set of system headers for stable native APIs that are guaranteed to be supported 2965 in all later releases of the platform:</p> 2966 2967 <ul> 2968 <li>libc (C library) headers</li> 2969 2970 <li>libm (math library) headers</li> 2971 2972 <li>JNI interface headers</li> 2973 2974 <li>libz (Zlib compression) headers</li> 2975 2976 <li>liblog (Android logging) header</li> 2977 2978 <li>OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers</li> 2979 2980 <li>libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).</li> 2981 2982 <li>A Minimal set of headers for C++ support</li> 2983 2984 <li>OpenSL ES native audio libraries</li> 2985 2986 <li>Android native application APIS</li> 2987 </ul> 2988 2989 <p>The NDK also provides a build system that lets you work efficiently with your sources, without 2990 having to handle the toolchain/platform/CPU/ABI details. You create very short build files to 2991 describe which sources to compile and which Android application will use them — the build 2992 system compiles the sources and places the shared libraries directly in your application 2993 project.</p> 2994 2995 <p class="caution"><strong>Important:</strong> With the exception of the libraries listed above, 2996 native system libraries in the Android platform are <em>not</em> stable and may change in future 2997 platform versions. Your applications should <em>only</em> make use of the stable native system 2998 libraries provided in this NDK.</p> 2999 3000 3001 3002 <h3 id="Docs">Documentation</h3> 3003 3004 <p>The NDK package includes a set of documentation that describes the capabilities of the NDK and 3005 how to use it to create shared libraries for your Android applications. In this release, the 3006 documentation is provided only in the downloadable NDK package. You can find the documentation in 3007 the <code><ndk>/docs/</code> directory. Included are these files (partial listing):</p> 3008 3009 <ul> 3010 <li> 3011 INSTALL.HTML — describes how to install the NDK and configure it for your host 3012 system</li> 3013 3014 <li>OVERVIEW.HTML — provides an overview of the NDK capabilities and usage</li> 3015 3016 <li>ANDROID-MK.HTML — describes the use of the Android.mk file, which defines the native 3017 sources you want to compile</li> 3018 3019 <li>APPLICATION-MK.HTML — describes the use of the Application.mk file, which describes 3020 the native sources required by your Android application</li> 3021 <li>CPLUSPLUS-SUPPORT.HTML — describes the C++ support provided in the Android NDK</li> 3022 <li>CPU-ARCH-ABIS.HTML — a description of supported CPU architectures and how to target 3023 them.</li> 3024 3025 <li>CPU-FEATURES.HTML — a description of the <code>cpufeatures</code> static library that 3026 lets your application code detect the target device's CPU family and the optional features at 3027 runtime.</li> 3028 3029 <li>CHANGES.HTML — a complete list of changes to the NDK across all releases.</li> 3030 3031 <li>DEVELOPMENT.HTML — describes how to modify the NDK and generate release packages for it</li> 3032 3033 <li>HOWTO.HTML — information about common tasks associated with NDK development</li> 3034 3035 <li>IMPORT-MODULE.HTML — describes how to share and reuse modules</li> 3036 3037 <li>LICENSES.HTML — information about the various open source licenses that govern the Android NDK</li> 3038 3039 <li>NATIVE-ACTIVITY.HTML — describes how to implement native activities</li> 3040 3041 <li>NDK-BUILD.HTML — describes the usage of the ndk-build script</li> 3042 3043 <li>NDK-GDB.HTML — describes how to use the native code debugger</li> 3044 3045 <li>PREBUILTS.HTML — information about how shared and static prebuilt libraries work </li> 3046 3047 <li>STANDALONE-TOOLCHAIN.HTML — describes how to use Android NDK toolchain as a standalone 3048 compiler (still in beta).</li> 3049 3050 <li>SYSTEM-ISSUES.HTML — known issues in the Android system images that you should be 3051 aware of, if you are developing using the NDK.</li> 3052 3053 <li>STABLE-APIS.HTML — a complete list of the stable APIs exposed by headers in the 3054 NDK.</li> 3055 3056 </ul> 3057 3058 <p>Additionally, the package includes detailed information about the "bionic" C library provided 3059 with the Android platform that you should be aware of, if you are developing using the NDK. You 3060 can find the documentation in the <code><ndk>/docs/system/libc/</code> directory:</p> 3061 3062 <ul> 3063 <li>OVERVIEW.HTML — provides an overview of the "bionic" C library and the features it 3064 offers.</li> 3065 </ul> 3066 3067 3068 3069 3070 3071 <h3 id="Samples">Sample apps</h3> 3072 3073 <p>The NDK includes sample applications that illustrate how to use native code in your Android 3074 applications:</p> 3075 3076 <ul> 3077 <li><code>hello-jni</code> — a simple application that loads a string from a native 3078 method implemented in a shared library and then displays it in the application UI.</li> 3079 3080 <li><code>two-libs</code> — a simple application that loads a shared library dynamically 3081 and calls a native method provided by the library. In this case, the method is implemented in a 3082 static library imported by the shared library.</li> 3083 3084 <li><code>san-angeles</code> — a simple application that renders 3D graphics through the 3085 native OpenGL ES APIs, while managing activity lifecycle with a {@link 3086 android.opengl.GLSurfaceView} object.</li> 3087 3088 <li><code>hello-gl2</code> — a simple application that renders a triangle using OpenGL ES 3089 2.0 vertex and fragment shaders.</li> 3090 3091 <li><code>hello-neon</code> — a simple application that shows how to use the 3092 <code>cpufeatures</code> library to check CPU capabilities at runtime, then use NEON intrinsics 3093 if supported by the CPU. Specifically, the application implements two versions of a tiny 3094 benchmark for a FIR filter loop, a C version and a NEON-optimized version for devices that 3095 support it.</li> 3096 3097 <li><code>bitmap-plasma</code> — a simple application that demonstrates how to access the 3098 pixel buffers of Android {@link android.graphics.Bitmap} objects from native code, and uses 3099 this to generate an old-school "plasma" effect.</li> 3100 3101 <li><code>native-activity</code> — a simple application that demonstrates how to use the 3102 native-app-glue static library to create a native activity</li> 3103 3104 <li><code>native-plasma</code> — a version of bitmap-plasma implemented with a native 3105 activity.</li> 3106 </ul> 3107 3108 <p>For each sample, the NDK includes the corresponding C source code and the necessary Android.mk 3109 and Application.mk files. There are located under <code><ndk>/samples/<name>/</code> 3110 and their source code can be found under <code><ndk>/samples/<name>/jni/</code>.</p> 3111 3112 <p>You can build the shared libraries for the sample apps by going into 3113 <code><ndk>/samples/<name>/</code> then calling the <code>ndk-build</code> command. 3114 The generated shared libraries will be located under 3115 <code><ndk>/samples/<name>/libs/armeabi/</code> for (ARMv5TE machine code) and/or 3116 <code><ndk>/samples/<name>/libs/armeabi-v7a/</code> for (ARMv7 machine code).</p> 3117 3118 <p>Next, build the sample Android applications that use the shared libraries:</p> 3119 3120 <ul> 3121 <li>If you are developing in Eclipse with ADT, use the New Project Wizard to create a new 3122 Android project for each sample, using the "Import from Existing Source" option and importing 3123 the source from <code><ndk>/samples/<name>/</code>. Then, set up an AVD, 3124 if necessary, and build/run the application in the emulator.</li> 3125 3126 <li>If you are developing with Ant, use the <code>android</code> tool to create the build file 3127 for each of the sample projects at <code><ndk>/samples/<name>/</code>. 3128 Then set up an AVD, if necessary, build your project in the usual way, and run it in the 3129 emulator.</li> 3130 3131 </ul> 3132 3133 <p>For more information about developing with the Android SDK tools and what 3134 you need to do to create, build, and run your applications, see 3135 the <a href="{@docRoot}tools/workflow/index.html">Overview</a> 3136 section for developing on Android.</p> 3137 3138 3139 3140 <h4 id="hello-jni">Exploring the hello-jni Sample</h4> 3141 3142 <p>The hello-jni sample is a simple demonstration on how to use JNI from an Android application. 3143 The HelloJni activity receives a string from a simple C function and displays it in a 3144 TextView.</p> 3145 3146 <p>The main components of the sample include:</p> 3147 3148 <ul> 3149 <li>The familiar basic structure of an Android application (an <code>AndroidManifest.xml</code> 3150 file, a <code>src/</code> and <code>res</code> directories, and a main activity)</li> 3151 3152 <li>A <code>jni/</code> directory that includes the implemented source file for the native code 3153 as well as the Android.mk file</li> 3154 3155 <li>A <code>tests/</code> directory that contains unit test code.</li> 3156 </ul> 3157 3158 <ol> 3159 <li>Create a new project in Eclipse from the existing sample source or use the 3160 <code>android</code> tool to update the project so it generates a build.xml file that you can 3161 use to build the sample. 3162 3163 <ul> 3164 <li>In Eclipse: 3165 3166 <ol type="a"> 3167 <li>Click <strong>File > New Android Project...</strong></li> 3168 3169 <li>Select the <strong>Create project from existing source</strong> radio button.</li> 3170 3171 <li>Select any API level above Android 1.5.</li> 3172 3173 <li>In the <strong>Location</strong> field, click <strong>Browse...</strong> and select 3174 the <code><ndk-root>/samples/hello-jni</code> directory.</li> 3175 3176 <li>Click <strong>Finish</strong>.</li> 3177 </ol> 3178 </li> 3179 3180 <li>On the command line: 3181 3182 <ol type="a"> 3183 <li>Change to the <code><ndk-root>/samples/hello-jni</code> directory.</li> 3184 3185 <li>Run the following command to generate a build.xml file: 3186 <pre class="no-pretty-print">android update project -p . -s</pre> 3187 </li> 3188 </ol> 3189 </li> 3190 </ul> 3191 </li> 3192 3193 <li>Compile the native code using the <code>ndk-build</code> command. 3194 <pre class="no-pretty-print"> 3195 cd <ndk-root>/samples/hello-jni 3196 <ndk_root>/ndk-build 3197 </pre> 3198 </li> 3199 3200 <li>Build and install the application as you would a normal Android application. If you are 3201 using Eclipse, run the application to build and install it on a device. If you are using Ant, 3202 run the following commands from the project directory: 3203 <pre class="no-pretty-print"> 3204 ant debug 3205 adb install bin/HelloJni-debug.apk 3206 </pre> 3207 </li> 3208 </ol> 3209 3210 <p>When you run the application on the device, the string <code>Hello JNI</code> should appear on 3211 your device. You can explore the rest of the samples that are located in the 3212 <code><ndk-root>/samples</code> directory for more examples on how to use the JNI.</p> 3213 3214 3215 3216 <h4 id="native-activity">Exploring the native-activity Sample Application</h4> 3217 3218 <p>The native-activity sample provided with the Android NDK demonstrates how to use the 3219 android_native_app_glue static library. This static library makes creating a native activity 3220 easier by providing you with an implementation that handles your callbacks in another thread, so 3221 you do not have to worry about them blocking your main UI thread. The main parts of the sample 3222 are described below:</p> 3223 3224 <ul> 3225 <li>The familiar basic structure of an Android application (an <code>AndroidManifest.xml</code> 3226 file, a <code>src/</code> and <code>res</code> directories). The AndroidManifest.xml declares 3227 that the application is native and specifies the .so file of the native activity. See {@link 3228 android.app.NativeActivity} for the source or see the 3229 <code><ndk_root>/platforms/samples/native-activity/AndroidManifest.xml</code> file.</li> 3230 3231 <li>A <code>jni/</code> directory contains the native activity, main.c, which uses the 3232 <code>android_native_app_glue.h</code> interface to implement the activity. The Android.mk that 3233 describes the native module to the build system also exists here.</li> 3234 </ul> 3235 3236 <p>To build this sample application:</p> 3237 3238 <ol> 3239 <li>Create a new project in Eclipse from the existing sample source or use the 3240 <code>android</code> tool to update the project so it generates a build.xml file that you can 3241 use to build the sample. 3242 3243 <ul> 3244 <li>In Eclipse: 3245 3246 <ol type="a"> 3247 <li>Click <strong>File > New Android Project...</strong></li> 3248 3249 <li>Select the <strong>Create project from existing source</strong> radio button.</li> 3250 3251 <li>Select any API level above Android 2.3.</li> 3252 3253 <li>In the <strong>Location</strong> field, click <strong>Browse...</strong> and select 3254 the <code><ndk-root>/samples/native-activity</code> directory.</li> 3255 3256 <li>Click <strong>Finish</strong>.</li> 3257 </ol> 3258 </li> 3259 3260 <li>On the command line: 3261 3262 <ol type="a"> 3263 <li>Change to the <code><ndk-root>/samples/native-activity</code> directory.</li> 3264 3265 <li>Run the following command to generate a build.xml file: 3266 <pre class="no-pretty-print"> 3267 android update project -p . -s 3268 </pre> 3269 </li> 3270 </ol> 3271 </li> 3272 </ul> 3273 </li> 3274 3275 <li>Compile the native code using the <code>ndk-build</code> command. 3276 <pre class="no-pretty-print"> 3277 cd <ndk-root>/platforms/samples/android-9/samples/native-activity 3278 <ndk_root>/ndk-build 3279 </pre> 3280 </li> 3281 3282 <li>Build and install the application as you would a normal Android application. If you are 3283 using Eclipse, run the application to build and install it on a device. If you are using Ant, 3284 run the following commands in the project directory, then run the application on the device: 3285 <pre class="no-pretty-print"> 3286 ant debug 3287 adb install bin/NativeActivity-debug.apk 3288 </pre> 3289 </li> 3290 </ol> 3291