1ndk=true
2page.template=sdk
3
4
5ndk.mac64_download=android-ndk-r10d-darwin-x86_64.bin
6ndk.mac64_bytes=442691567
7ndk.mac64_checksum=cb101e1e62d56ea75b215f6bc6c27fae
8
9ndk.mac32_download=android-ndk-r10d-darwin-x86.bin
10ndk.mac32_bytes=441545213
11ndk.mac32_checksum=0aeb3dc062dc457a4cd01e72eadb2379
12
13ndk.linux64_download=android-ndk-r10d-linux-x86_64.bin
14ndk.linux64_bytes=459151600
15ndk.linux64_checksum=263b83071e6bca15f67898548d8d236e
16
17ndk.linux32_download=android-ndk-r10d-linux-x86.bin
18ndk.linux32_bytes=449997190
19ndk.linux32_checksum=70ed6d8c34e7e620c145b791e8eeef89
20
21ndk.win64_download=android-ndk-r10d-windows-x86_64.exe
22ndk.win64_bytes=472613732
23ndk.win64_checksum=9a33f96da58a7e0b70e47d27b4a880b4
24
25ndk.win32_download=android-ndk-r10d-windows-x86.exe
26ndk.win32_bytes=455427281
27ndk.win32_checksum=c0930abfae0c990c4d191cc4ebd46b68
28
29
30
31page.title=Android NDK
32@jd:body
33
34
35
36
37<div id="tos" style="display:none;width:760px;height:0;margin:0 auto">
38
39<div id="download" class="ndk" style="
40z-index: 99;
41width: 720px;
42position: absolute;
43margin: -70px 0;
44padding: 14px;
45background: white;
46border: 1px solid #999;
47box-shadow: -10px 10px 50px #888;
48-moz-box-shadow: -10px 10px 50px #888;
49-webkit-box-shadow: -10px 10px 50px #888;">
50<p>Before installing the Android NDK, you must agree to the following terms and conditions.</p>
51<div class="sdk-terms" style="width:auto" onfocus="this.blur()">
52<h2 class="norule">Terms and Conditions</h2>
53This is the Android Software Development Kit License Agreement
54
55<h3>1. Introduction</h3>
561.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and
57specifically including the Android system files, packaged APIs, and Google APIs add-ons) is
58licensed to you subject to the terms of this License Agreement. This License Agreement forms a
59legally binding contract between you and Google in relation to your use of the SDK.
60
611.2 “Android” means the Android software stack for devices, as made available under the Android
62Open Source Project, which is located at the following URL: http://source.android.com/, as updated
63from time to time.
64
651.3 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600
66Amphitheatre Parkway, Mountain View, CA 94043, United States.
67
68
69<h3>2. Accepting this License Agreement</h3>
702.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the
71SDK if you do not accept this License Agreement.
72
732.2 By clicking to accept, you hereby agree to the terms of this License Agreement.
74
752.3 You may not use the SDK and may not accept the License Agreement if you are a person barred
76from receiving the SDK under the laws of the United States or other countries including the country
77in which you are resident or from which you use the SDK.
78
792.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other
80entity, you represent and warrant that you have full legal authority to bind your employer or such
81entity to this License Agreement. If you do not have the requisite authority, you may not accept
82the License Agreement or use the SDK on behalf of your employer or other entity.
83
84
85<h3>3. SDK License from Google</h3>
863.1 Subject to the terms of this License Agreement, Google grants you a limited, worldwide,
87royalty-free, non-assignable and non-exclusive license to use the SDK solely to develop
88applications to run on the Android platform.
89
903.2 You agree that Google or third parties own all legal right, title and interest in and to the
91SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property
92Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law,
93and any and all other proprietary rights. Google reserves all rights not expressly granted to you.
94
953.3 You may not use the SDK for any purpose not expressly permitted by this License Agreement.
96Except to the extent required by applicable third party licenses, you may not: (a) copy (except for
97backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create
98derivative works of the SDK or any part of the SDK; or (b) load any part of the SDK onto a mobile
99handset or any other hardware device except a personal computer, combine any part of the SDK with
100other software, or distribute any software or device incorporating a part of the SDK.
101
1023.4 You agree that you will not take any actions that may cause or result in the fragmentation of
103Android, including but not limited to distributing, participating in the creation of, or promoting
104in any way a software development kit derived from the SDK.
105
1063.5 Use, reproduction and distribution of components of the SDK licensed under an open source
107software license are governed solely by the terms of that open source software license and not this
108License Agreement.
109
1103.6 You agree that the form and nature of the SDK that Google provides may change without prior
111notice to you and that future versions of the SDK may be incompatible with applications developed
112on previous versions of the SDK. You agree that Google may stop (permanently or temporarily)
113providing the SDK (or any features within the SDK) to you or to users generally at Google's sole
114discretion, without prior notice to you.
115
1163.7 Nothing in this License Agreement gives you a right to use any of Google's trade names,
117trademarks, service marks, logos, domain names, or other distinctive brand features.
118
1193.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including
120copyright and trademark notices) that may be affixed to or contained within the SDK.
121
122
123<h3>4. Use of the SDK by You</h3>
1244.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under
125this License Agreement in or to any software applications that you develop using the SDK, including
126any intellectual property rights that subsist in those applications.
127
1284.2 You agree to use the SDK and write applications only for purposes that are permitted by (a)
129this License Agreement and (b) any applicable law, regulation or generally accepted practices or
130guidelines in the relevant jurisdictions (including any laws regarding the export of data or
131software to and from the United States or other relevant countries).
132
1334.3 You agree that if you use the SDK to develop applications for general public users, you will
134protect the privacy and legal rights of those users. If the users provide you with user names,
135passwords, or other login information or personal information, you must make the users aware that
136the information will be available to your application, and you must provide legally adequate
137privacy notice and protection for those users. If your application stores personal or sensitive
138information provided by users, it must do so securely. If the user provides your application with
139Google Account information, your application may only use that information to access the user's
140Google Account when, and for the limited purposes for which, the user has given you permission to
141do so.
142
1434.4 You agree that you will not engage in any activity with the SDK, including the development or
144distribution of an application, that interferes with, disrupts, damages, or accesses in an
145unauthorized manner the servers, networks, or other properties or services of any third party
146including, but not limited to, Google or any mobile communications carrier.
147
1484.5 You agree that you are solely responsible for (and that Google has no responsibility to you or
149to any third party for) any data, content, or resources that you create, transmit or display
150through Android and/or applications for Android, and for the consequences of your actions
151(including any loss or damage which Google may suffer) by doing so.
152
1534.6 You agree that you are solely responsible for (and that Google has no responsibility to you or
154to any third party for) any breach of your obligations under this License Agreement, any applicable
155third party contract or Terms of Service, or any applicable law or regulation, and for the
156consequences (including any loss or damage which Google or any third party may suffer) of any such
157breach.
158
159
160<h3>5. Your Developer Credentials</h3>
1615.1 You agree that you are responsible for maintaining the confidentiality of any developer
162credentials that may be issued to you by Google or which you may choose yourself and that you will
163be solely responsible for all applications that are developed under your developer credentials.
164
165
166<h3>6. Privacy and Information</h3>
1676.1 In order to continually innovate and improve the SDK, Google may collect certain usage
168statistics from the software including but not limited to a unique identifier, associated IP
169address, version number of the software, and information on which tools and/or services in the SDK
170are being used and how they are being used. Before any of this information is collected, the SDK
171will notify you and seek your consent. If you withhold consent, the information will not be
172collected.
173
1746.2 The data collected is examined in the aggregate to improve the SDK and is maintained in
175accordance with Google's Privacy Policy.
176
177
178<h3>7. Third Party Applications</h3>
1797.1 If you use the SDK to run applications developed by a third party or that access data, content
180or resources provided by a third party, you agree that Google is not responsible for those
181applications, data, content, or resources. You understand that all data, content or resources which
182you may access through such third party applications are the sole responsibility of the person from
183which they originated and that Google is not liable for any loss or damage that you may experience
184as a result of the use or access of any of those third party applications, data, content, or
185resources.
186
1877.2 You should be aware the data, content, and resources presented to you through such a third
188party application may be protected by intellectual property rights which are owned by the providers
189(or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell,
190distribute or create derivative works based on these data, content, or resources (either in whole
191or in part) unless you have been specifically given permission to do so by the relevant owners.
192
1937.3 You acknowledge that your use of such third party applications, data, content, or resources may
194be subject to separate terms between you and the relevant third party. In that case, this License
195Agreement does not affect your legal relationship with these third parties.
196
197
198<h3>8. Using Android APIs</h3>
1998.1 Google Data APIs
200
2018.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be
202protected by intellectual property rights which are owned by Google or those parties that provide
203the data (or by other persons or companies on their behalf). Your use of any such API may be
204subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or
205create derivative works based on this data (either in whole or in part) unless allowed by the
206relevant Terms of Service.
207
2088.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you
209shall retrieve data only with the user's explicit consent and only when, and for the limited
210purposes for which, the user has given you permission to do so.
211
212
213<h3>9. Terminating this License Agreement</h3>
2149.1 This License Agreement will continue to apply until terminated by either you or Google as set
215out below.
216
2179.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK
218and any relevant developer credentials.
219
2209.3 Google may at any time, terminate this License Agreement with you if:
221(A) you have breached any provision of this License Agreement; or
222(B) Google is required to do so by law; or
223(C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated
224its relationship with Google or ceased to offer certain parts of the SDK to you; or
225(D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country
226in which you are resident or from which you use the service, or the provision of the SDK or certain
227SDK services to you by Google is, in Google's sole discretion, no longer commercially viable.
228
2299.4 When this License Agreement comes to an end, all of the legal rights, obligations and
230liabilities that you and Google have benefited from, been subject to (or which have accrued over
231time whilst this License Agreement has been in force) or which are expressed to continue
232indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall
233continue to apply to such rights, obligations and liabilities indefinitely.
234
235
236<h3>10. DISCLAIMER OF WARRANTIES</h3>
23710.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE
238SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE.
239
24010.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE
241SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR
242COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE.
243
24410.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS
245OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY,
246FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
247
248
249<h3>11. LIMITATION OF LIABILITY</h3>
25011.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS
251LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT,
252INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY
253LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN
254AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
255
256
257<h3>12. Indemnification</h3>
25812.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless
259Google, its affiliates and their respective directors, officers, employees and agents from and
260against any and all claims, actions, suits or proceedings, as well as any and all losses,
261liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or
262accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes
263any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of
264any person or defames any person or violates their rights of publicity or privacy, and (c) any
265non-compliance by you with this License Agreement.
266
267
268<h3>13. Changes to the License Agreement</h3>
26913.1 Google may make changes to the License Agreement as it distributes new versions of the SDK.
270When these changes are made, Google will make a new version of the License Agreement available on
271the website where the SDK is made available.
272
273
274<h3>14. General Legal Terms</h3>
27514.1 This License Agreement constitutes the whole legal agreement between you and Google and
276governs your use of the SDK (excluding any services which Google may provide to you under a
277separate written agreement), and completely replaces any prior agreements between you and Google in
278relation to the SDK.
279
28014.2 You agree that if Google does not exercise or enforce any legal right or remedy which is
281contained in this License Agreement (or which Google has the benefit of under any applicable law),
282this will not be taken to be a formal waiver of Google's rights and that those rights or remedies
283will still be available to Google.
284
28514.3 If any court of law, having the jurisdiction to decide on this matter, rules that any
286provision of this License Agreement is invalid, then that provision will be removed from this
287License Agreement without affecting the rest of this License Agreement. The remaining provisions of
288this License Agreement will continue to be valid and enforceable.
289
29014.4 You acknowledge and agree that each member of the group of companies of which Google is the
291parent shall be third party beneficiaries to this License Agreement and that such other companies
292shall be entitled to directly enforce, and rely upon, any provision of this License Agreement that
293confers a benefit on (or rights in favor of) them. Other than this, no other person or company
294shall be third party beneficiaries to this License Agreement.
295
29614.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST
297COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE
298LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE.
299
30014.6 The rights granted in this License Agreement may not be assigned or transferred by either you
301or Google without the prior written approval of the other party. Neither you nor Google shall be
302permitted to delegate their responsibilities or obligations under this License Agreement without
303the prior written approval of the other party.
304
30514.7 This License Agreement, and your relationship with Google under this License Agreement, shall
306be governed by the laws of the State of California without regard to its conflict of laws
307provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located
308within the county of Santa Clara, California to resolve any legal matter arising from this License
309Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for
310injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
311
312
313<em>November 13, 2012</em>
314</div>
315
316
317
318<div id="sdk-terms-form">
319<p>
320<input id="agree" type="checkbox" name="agree" value="1" onclick="onAgreeChecked()" />
321<label id="agreeLabel" for="agree">I have read and agree with the above terms and conditions</label>
322</p>
323<p><a href="" class="button disabled ndk" id="downloadForRealz" onclick="return onDownloadNdkForRealz(this);"></a></p>
324</div>
325
326
327
328</div>
329</div>
330
331 <div id="qv-wrapper">
332    <div id="qv">
333      <h2>In this document</h2>
334
335      <ol>
336        <li><a href="#Downloads">Downloads</a></li>
337        <li><a href="#Revisions">Revisions</a></li>
338        <li><a href="#Reqs">System and Software Requirements</a></li>
339        <li><a href="#Installing">Installing the NDK</a></li>
340        <li><a href="#GetStarted">Getting Started with the NDK</a>
341          <ol>
342            <li><a href="#Using">Using the NDK</a></li>
343          </ol>
344        </li>
345        <li><a href="#Contents">Contents of the NDK</a>
346          <ol>
347            <li><a href="#Tools">Development tools</a></li>
348            <li><a href="#Docs">Documentation</a></li>
349            <li><a href="#Samples">Sample apps</a></li>
350          </ol>
351        </li>
352      </ol>
353    </div>
354  </div>
355
356  <p>The NDK is a toolset that allows you to implement parts
357  of your app using native-code languages such as C and C++. For certain types of apps,
358  this can be helpful so you can reuse existing code libraries written in these
359  languages, but most apps do not need the Android NDK.</p>
360
361  <p>Before downloading the NDK, you should understand that <strong>the NDK
362   will not benefit most apps</strong>. As a developer, you need to balance its benefits
363  against its drawbacks. Notably, using native code on Android
364  generally does not result in a noticable performance improvement,
365  but it always increases your app complexity. In general, you should only use the NDK
366  if it is essential to your app&mdash;never because you simply prefer to program in C/C++.</p>
367
368  <p>Typical good candidates for the NDK are CPU-intensive workloads such as game engines,
369  signal processing, physics simulation, and so on. When examining
370  whether or not you should develop in native code, think about your requirements and see if the
371  Android framework APIs provide the functionality that you need.</p>
372
373
374<h2 id="Downloads">Downloads</h2>
375
376
377<script>
378$('#Downloads').after($('#download-table'));
379</script>
380
381<h2 id="Revisions">Revisions</h2>
382
383<p>The following sections provide information about releases of the NDK.</p>
384
385
386<div class="toggle-content opened">
387 <p>
388   <a href="#" onclick="return toggleContent(this)"> <img
389     src="/assets/images/triangle-opened.png" class="toggle-content-img" alt=""
390   >Android NDK, Revision 10d</a> <em>(December 2014)</em>
391 </p>
392 <div class="toggle-content-toggleme">
393    <dl>
394      <dt>Important changes:</dt>
395      <dd>
396      <ul>
397        <li>Made GCC 4.8 the default for all 32-bit ABIs.  Deprecated GCC 4.6, and
398            will remove it next release. To restore previous behavior, either add
399            <code>NDK_TOOLCHAIN_VERSION=4.6</code> to ndk-build, or
400            add <code>--toolchain=arm-linux-androideabi-4.6</code> when executing
401            <code>make-standalone-toolchain.sh</code> on the command line. GCC 4.9 remains the
402            default for 64-bit ABIs.</li>
403
404         <li>Stopped all x86[_64] toolchains from adding <code>-mstackrealign</code> by default. The
405             NDK toolchain assumes a 16-byte stack alignment. The tools and options used by default
406             enforce this rule. A user writing assembly code must make sure to preserve stack
407             alignment, and ensure that other compilers also comply with this rule.
408             (GCC bug <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496">38496</a>)</li>
409
410         <li>Added Address Sanitizer functionality to Clang 3.5 support to the ARM and x86 ABIs.
411             For more information on this change, see the
412             <a href="https://code.google.com/p/address-sanitizer/wiki/Android">Address
413             Sanitizer</a> project.</li>
414
415         <li>Introduced the requirement, starting from API level 21, to use <code>-fPIE -pie
416             </code> when building. In API levels 16 and higher, ndk-build uses <code>PIE</code>
417             when building. This change has a number of implications, which are discussed in
418             <a href="https://code.google.com/p/android-developer-preview/issues/detail?id=888">
419             Developer Preview Issue 888</a>.
420             These implications do not apply to shared libraries.</li>
421      </ul>
422      </dd>
423   <dl>
424
425
426     <dt>Important bug fixes:</dt>
427     <dd>
428     <ul>
429        <li>Made more fixes related to
430            <a href="https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00906.html">
431            A53 Errata #835769</a> in the aarch64-linux-android-4.9 linker. As part of this, GCC
432            passes a new option, <code>--fix-cortex-a53-835769</code>, when
433            <code>-mfix-cortex-a53-835769</code> (enabled by default) is specified.
434            For more information, see this
435            <a href="https://sourceware.org/ml/binutils/2014-10/msg00198.html">binutils message</a>
436            and this
437            <a href="https://sourceware.org/ml/binutils/2014-11/msg00287.html">binutils message</a>.
438            </li>
439
440        <li>Documented a fix to a libc++ <code>sscanf/vsscanf</code> hang that occurred in API level
441            21. The fix itself had been implemented in r10c.
442            (Issue <a href="http://b.android.com/77988">77988</a>)</li>
443
444        <li>Fixed an AutoFDO (<code>-fauto-profile</code>) crash that occurred with GCC 4.9 when
445            <code>-Os</code> was specified. (Issue <a href="http://b.android.com/77571">77571</a>)</li>
446     </ul>
447     </dd>
448
449
450     <dt>Other bug fixes:</dt>
451     <dd>
452     <ul>
453        <li>Made the following header and library fixes:</li>
454           <ul>
455        <li>Added <code>posix_memalign</code> to API level 16. Also, added a prototype in
456            <code>stdlib.h</code> to API levels 16 to 19.
457            (Issue <a href="http://b.android.com/77861">77861</a>)</li>
458        <li>Fixed <code>stdatomic.h</code> so that it includes <code>&lt;atomic&gt;</code> only for
459            C++11.</li>
460        <li>Modified the following headers for standalone use: <code>sys/user.h</code>, and
461            <code>gl2ext.h</code>, <code>dlext.h</code>, <code>fts.h</code>, <code>sgidefs.h</code>
462            for API level 21.</li>
463        <li>Modified <code>sys/user.h</code> to rename <code>mxcsr_mask</code> as <code>mxcr_mask</code>,
464            and to change the data type for <code>u_ar0</code></li> from <code>unsigned long</code>
465            to </code>struct user_regs_struct*</code>.
466        <li>Changed <code>sysconf()</code> return value type from <code>int</code> to
467            <code>long</code>.</li>
468           </ul>
469
470        <li>Fixed ndk-build's handling of <code>thumb</code> for <code>LOCAL_ARM_MODE</code>: In
471            r10d, ndk-build adds <code>LOCAL_LDFLAGS+=-mthumb</code> by default, unless one of the
472            following conditions applies:</li>
473          <ul>
474            <li>You have set <code>LOCAL_ARM_MODE</code> equal to <code>arm</code>.</li>
475            <li>You are doing a debug build (with settings such as <code>APP_OPTIM=debug</code> and
476            <code>AndroidManifest.xml</code> containing <code>android:debuggable="true"</code>),
477            where ARM mode is the default in order to retain compatibility with earlier toolchains.
478            (Issue <a href="http://b.android.com/74040">74040</a>)</li>
479          </ul>
480
481        <li>Fixed <code>LOCAL_SRC_FILES</code> in ndk-build to use Windows absolute paths.
482            (Issue <a href="http://b.android.com/74333">74333</a>)</li>
483
484        <li>Removed bash-specific code from ndk-gdb. (Issue <a href="http://b.android.com/73338">73338</a>)</li>
485
486        <li>Removed bash-specific code from <code>make-standalone-toolchain.sh</code>.
487            (Issue <a href="http://b.android.com/74145">74145)</a></li>
488
489        <li>Revised documentation concerning a fix for <code>System.loadLibrary()</code> transitive
490            dependencies. (Issue <a href="http://b.android.com/41790">41790</a>)</li>
491
492        <li>Fixed a problem that was preventing 64-bit packages from extracting on Ubuntu 14.04 and
493            OS X 10.10 (Yosemite). (Issue <a href="http://b.android.com/78148">78148</a>)</li>
494
495        <li>Fixed an issue with <code>LOCAL_PCH</code> to improve Clang support. (Issue
496            <a href="http://b.android.com/77575">77575</a>)</li>
497
498        <li>Clarified "requires executable stack" warning from ld.gold. (Issue
499            <a href="http://b.android.com/79115">79115</a>)</li>
500     </ul>
501     </dd>
502
503   </dl>
504 </div>
505</div>
506
507
508
509
510
511
512
513<div class="toggle-content closed">
514 <p>
515   <a href="#" onclick="return toggleContent(this)"> <img
516     src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
517   >Android NDK, Revision 10c</a> <em>(October 2014)</em>
518 </p>
519 <div class="toggle-content-toggleme">
520    <dl>
521      <dt>Important changes:</dt>
522      <dd>
523      <ul>
524 <li>Made the following changes to download structure:</li>
525       <ul>
526       <li>Each package now contains both the 32- and the 64-bit headers, libraries, and tools for
527       its respective platform.</li>
528       <li>STL libraries with debugging info no longer need be downloaded separately.</li>
529       </ul>
530  <li>Changed everything previously called <code>Android-L</code> to the official release
531  designation: <code>android-21</code>.</li>
532  <li>Updated GCC 4.9 by rebasing to the <code>google</code> branch
533  of the GCC repository. Major differences from the upstream version of GCC 4.9 include:</li>
534
535  <ul>
536  <li>The <code>-O2</code> option now turns on vectorization, without loop peeling but with more
537  aggressive unrolling.</li>
538  <li>Enhancements to FDO and <a href="https://gcc.gnu.org/wiki/LightweightIpo#LIPO_-_Profile_Feedback_Based_Lightweight_IPO">
539  LIPO</a></li>
540  <p>For more detailed information, see <em>Important bug fixes</em> below.</p>
541  </ul>
542
543  <li>Added Clang 3.5 support to all hosts: <code>NDK_TOOLCHAIN_VERSION=clang</code>
544  now picks Clang 3.5. Note that:</li>
545  <ul>
546
547  <li>ARM and x86 default to using the integrated assembler. If this causes issues, use
548  <code>-fno-integrated-as</code> as a workaround.</code>
549  <li>Clang 3.5 issues more warnings for unused flags, such as the <code>-finline-functions</code>
550  option that GCC supports.</li>
551  <p>When migrating from projects using GCC, you can use
552  <code>-Wno-invalid-command-line-argument</code> and <code>-Wno-unused-command-line-argument</code>
553  to ignore the unused flags until you're able decide on what to do with them longer-term.</p>
554
555     </ul>
556  <li>Made it possible to enter ART debugging mode, when debugging on an Android 5.0 device using
557  ART as its virtual machine, by specifying the <code>art-on</code> option. For more information,
558  see <code>prebuilt/common/gdb/common.setup</code> in the directory containing the NDK.</li>
559  <li>Removed support for Clang 3.3.</li>
560  <li>Deprecated GCC 4.6, and may remove it from future releases.</li>
561  <li>Updated mclinker to 2.8 with Identical Code Folding ("ICF") support. Specify ICF using the
562  <code>--icf</code> option.</li>
563  <li>Broadened <code>arm_neon.h</code> support in x86 and x86_64, attaining coverage of ~93% of
564  NEON intrinsics. For more information about NEON support:
565     <ul>
566     <li>Navigate to the NDK Programmer's Guide (<code>docs/Programmers_Guide/html/</code>), and see
567     Architectures and CPUs > Neon.</li>
568     <li>Examine the updated <code>hello-neon</code> sample in <code>samples/</code>.
569     <li>See Intel's guide to <a href="https://software.intel.com/en-us/blogs/2012/12/12/from-arm-neon-to-intel-mmxsse-automatic-porting-solution-tips-and-tricks"> porting from ARM NEON to Intel SSE.</a></li>
570     </ul>
571  <li>Documented support for <code>_FORTIFY_SOURCE</code> in <code>headers/libs/android-21</code>,
572  which appeared in r10 (when <code>android-21</code> was still called <code>Android-L</code>),
573  but had no documentation.</li>
574      </ul>
575      </dd>
576   <dl>
577
578
579     <dt>Important bug fixes:</dt>
580     <dd>
581     <ul>
582       <li>Fixed an internal compiler error with GCC4.9/aarch64 that was causing the following
583       error message (Issue <a href="http://b.android.com/77564">77564</a>):</li>
584<pre>
585internal compiler error: in simplify_const_unary_operation, at simplify-rtx.c:1539
586</pre>
587       <li>Fixed incorrect code generation from GCC4.9/arm. (Issue
588       <a href="http://b.android.com/77567">77567<a>)</li>
589       <li>Fixed an internal compiler error with GCC4.9/mips involving inline-assembly. (Issue
590       <a href="http://b.android.com/77568">77568</a>)</li>
591       <li>Fixed incorrect code that GCC4.9/arm was generating for <code>x = (cond) ? y : x</code>.
592       (Issue <a href="http://b.android.com/77569">77569</a>)</li>
593       <li>Fixed GCC4.9/aarch64 and Clang3.5/aarch64 to work around the
594       <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141006/116322.html">
595       Cortex-A53 erratum (835769)</a>  by default.  Disable the workaround by specifying
596       <code>-mno-fix-cortex-a53-835769</code>.</li>
597     </ul>
598     </dd>
599
600
601     <dt>Other bug fixes:</dt>
602     <dd>
603     <ul>
604     <li>Made the following header and library fixes to <code>android-21</code>:
605        <ul>
606
607        <li>Added more TV keycodes: <code>android/keycodes.h</code></li>
608        <li>Added more constants and six new sensor functions to <code>android/sensor.h</code>:
609        <code>ASensorManager_getDefaultSensorEx</code>, <code>ASensor_getFifoMaxEventCount</code>,
610        <code>ASensor_getFifoReservedEventCount</code>, <code>ASensor_getStringType</code>,
611        <code>ASensor_getReportingMode</code>, and <code>ASensor_isWakeUpSensor</code>.</li>
612        <li>Fixed <code>stdatomic.h</code> to improve compatibility with GCC 4.6, and provide support
613        for the <code>&lt;atomic&gt;</code> header.</li>
614        <li>Added <code>sys/ucontext.h</code> and <code>sys/user.h</code> to all API levels. The
615        <code>signal.h</code> header now includes <code>&lt;sys/ucontext.h&gt;</code>.  You may
616        remove any existing definition of <code>struct ucontext</code>.</li>
617        <li>Added <code>posix_memalign</code> to API levels 17, 18, and 19.</li>
618        <li>Added the following functions to all architectures:
619        <code>android_set_abort_message</code>, <code>posix_fadvise</code>,
620        <code>posix_fadvise64</code>, <code>pthread_gettid_np</code>.</li>
621        <li>Added the required permissions to the <code>native-media/AndroidManifest.xml</code>
622        sample.
623        (Issue <a href="https://android-review.googlesource.com/#/c/106640/">106640</a>)</li>
624        <li>Added <code>clock_nanosleep</code> and <code>clock_settime</code> to API level 21. (Issue
625        <a href="http://b.android.com/77372">77372</a>)
626        <li>Removed the following symbols from all architectures:
627        <code>get_malloc_leak_info</code>, <code>free_malloc_leak_info</code>,
628        <code>__srget</code>, <code>__swbuf</code>, <code>__srefill</code>, <code>__swsetup</code>,
629        <code>__sdidinit</code>, <code>__sflags</code>, <code>__sfp</code>,
630        <code>__sinit</code>, <code>__smakebuf</code>, <code>__sflush</code>, <code>__sread</code>,
631        <code>__swrite</code>, <code>__sseek</code>, <code>__sclose</code>,
632        <code>_fwalk</code>, <code>__sglue</code>, <code>__get_thread</code>, <code>__wait4</code>,
633        <code>__futex_wake</code>, <code>__open</code>, <code>__get_tls</code>,
634        <code>__getdents64</code>, and <code>dlmalloc</code>.</li>
635        <li>Removed the following functions from the 64-bit architectures: <code>basename_r</code>,
636        <code>dirname_r</code>, <code>__isthreaded</code>, <code>_flush_cache</code> (mips64).</li>
637        <li>Removed the following function from the 32-bit architectures:
638        <code>__signalfd4</code>.</li>
639        <li>Changed the type of the third argument from <code>size_t</code> to <code>int</code> in
640        the following functions: <code>strtoll_l</code>, <code>strtoull_l</code>,
641        <code>wcstoll_l</code>, and <code>wcstoull_l</code>.</li>
642        <li>Restored the following functions to the 64-bit architecture: <code>arc4random</code>,
643        <code>arc4random_buf</code>, and <code>arc4random_uniform</code>.</li>
644        <li>Moved <code>cxa_*</code> and the <code>new</code> and <code>delete</code> operators back
645        to <code>libstdc++.so</code>. This change restores r9d behavior; previous versions of r10
646        contained dummy files.</li>
647
648        </ul>
649     <li>Restored MXU support in GCC 4.8 and 4.9 for mips. This support had been absent from
650     r10 and r10b because those versions of GCC had been compiled with binutils-2.24, which did
651     not support MXU. It now does.</li>
652     <li>Fixed <code>--toolchain=</code> in <code>make-standalone-toolchain.sh</code> so that it
653     now properly supports use of a suffix specifying a version of Clang.</li>
654     <li>Fixed the libc++/armeabi <code>strtod()</code> functions.</li>
655     <li>Made fixes to NDK documentation in <code>docs/</code>.</li>
656     </ul>
657     </dd>
658
659     <dt>Other changes:</dt>
660     <dd>
661       <ul>
662       <li>Enhanced <code>cpu-features</code> to detect ARMv8 support for the following
663       instruction sets: AES, CRC32, SHA2, SHA1, and 64-bit PMULL/PMULL2. (Issue
664       <a href="https://android-review.googlesource.com/#/c/106360/">106360</a>)</li>
665
666       <li>Modified ndk-build to use <code>*-gcc-ar</code>, which is available in GCC 4.8, GCC 4.9, and
667       Clang. Clang specifies it, instead of <code>*-ar</code>. This setting brings improved LTO
668       support.</li>
669
670       <li>Removed the <code>include-fixed/linux/a.out.h</code> and
671       <code>include-fixed/linux/compiler.h</code> headers from the GCC compiler.
672       (Issue <a href ="http://b.android.com/73728">73728</a>)</li>
673
674       <li>Fixed an issue related to <code>-flto</code> with GCC 4.8 on Mac OS X. The error message
675       read:</li>
676
677       <pre>
678.../ld: error: .../libexec/gcc/arm-linux-androideabi/4.9/liblto_plugin.so
679Symbol not found: _environ
680</pre>
681
682       <li>Fixed a typo in <code>build-binary.mk.</code> (Issue
683       <a href="http://b.android.com/76992">76992</a>)</li>
684     </ul>
685     </dd>
686
687   <dt>Important known issues:</dt>
688     <dd>
689     <ul>
690     <li>Specifying -Os (<code>-fauto-profile</code>) in GCC4.9 may cause crashing.
691     (Issue <a href="http://b.android.com/77571">77571</a>)</li>
692     </ul>
693     </dd>
694
695   </dl>
696 </div>
697</div>
698
699<div class="toggle-content closed">
700 <p>
701   <a href="#" onclick="return toggleContent(this)"> <img
702     src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
703   >Android NDK, Revision 10b</a> <em>(September 2014)</em>
704 </p>
705 <div class="toggle-content-toggleme">
706   <dl>
707
708        <dt>Important notes:</dt>
709     <dd>
710     <ul>
711      <li>Because of the 512MB size restriction on downloadable packages, the following 32-bit items are not in the 32-bit NDK download packages. Instead, they reside in the 64-bit ones:</li>
712      <ul>
713      <li>Android-L headers</li>
714      <li>GCC 4.9</li>
715      </ul>
716     <li>Currently, the only Renderscript support provided by the NDK is for 32-bit Renderscript with Android 4.4 (API level 19). You cannot build HelloComputeNDK (the only Renderscript sample) with any other combination of Renderscript (32- or 64-bit) and Android version.</li>
717     <li>To compile native-codec, you must use a 64-bit NDK package, which is where all the Android-L headers are located. </li>
718     </ul>
719     </dd>
720
721
722     <dt>Important bug fixes:</dt>
723     <dd>
724     <ul>
725     <li>Fixed gdb 7.6 in GCC 4.8/4.9. (Issues <a href="http://b.android.com/74112">74112</a> and <a href="http://b.android.com/74371">74371</a>.)</li>
726     <li>Fixed GCC 4.8/4.9 for x86, so that they no longer enable <code>-msse4.2</code> and <code>-mpopcnt</code> by default. (Issue <a href="http://b.android.com/73843">73843</a>.)</li>
727     </ul>
728     </dd>
729
730     <dt>Other bug fixes:</dt>
731     <dd>
732     <ul>
733     <li>Removed <code>stdio.h</code> from the <code>include-fixed/</code> directories of all versions of GCC. (Issue <a href="http://b.android.com/73728">73728</a>.)</li>
734     <li>Removed duplicate header files from the Windows packages in the <code>platforms/android-L/arch-*/usr/include/linux/netfilter*/</code> directories. (Issue <a href="https://code.google.com/p/android/issues/detail?id=73704">73704</a>.)</li>
735     <li>Fixed a problem that prevented Clang from building HelloComputeNDK.</li>
736     <li>Fixed atexit. (Issue <a href="http://b.android.com/66595">66595</a>.)</li>
737     <li>Made various fixes to the docs in <code>docs/</code> and <code>sources/third_party/googletest/README.NDK</code>. (Issue <a href="http://b.android.com/74069">74069</a>.)</li>
738     <li>Made the following fixes to the Android-L headers:</li>
739     <ol>
740     <li>Added the following functions to <code>ctype.h</code> and <code>wchar.h</code>: <code>dn_expand()</code>, <code>grantpt()</code>, <code> inet_nsap_addr()</code>, <code>inet_nsap_ntoa()</code>, <code>insque()</code>, <code>nsdispatch()</code>, <code>posix_openpt()</code>, <code>__pthread_cleanup_pop()</code>, <code>__pthread_cleanup_push()</code>, <code>remque()</code>, <code>setfsgid()</code>, <code>setfsuid()</code>, <code>splice()</code>, <code>tee()</code>, <code>twalk()</code> (Issue <a href = "http://b.android.com/73719">73719</a>), and 42 <code>*_l()</code> functions.</li>
741
742    <li>Renamed <code>cmsg_nxthdr</code> to <code>__cmsg_nxthdr</code>.</li>
743
744    <li>Removed <code>__libc_malloc_dispatch</code>.</li>
745
746    <li>Changed the <code>ptrace()</code> prototype to <code>long ptrace(int, ...);</code>.</li>
747
748    <li>Removed <code>sha1.h</code>.</li>
749
750    <li>Extended <code>android_dlextinfo</code> in <code>android/dlext.h</code>.</li>
751
752    <li>Annotated <code>__NDK_FPABI__</code> for functions receiving or returning float- or double-type values in <code>stdlib.h</code>, <code>time.h</code>, <code>wchar.h</code>, and <code>complex.h</code>.</li>
753    </ol>
754     </ul>
755     </dd>
756
757     <dt>Other changes:</dt>
758     <dd>
759     <ul>
760        <li>Updated <code>mipsel-linux-android-4.9</code> and <code>mips64el-linux-android-4.9</code>, implementing a new multilib directory layout, and providing support for gdb-7.7</li>
761        <li>Enhanced <code>cpu-features</code> to detect more arm64 features.  (Change list <a href="https://android-review.googlesource.com/#/c/100339">100339</a>.)</li>
762     </dd>
763     </ul>
764
765   </dl>
766 </div>
767</div>
768
769<div class="toggle-content closed">
770 <p>
771   <a href="#" onclick="return toggleContent(this)"> <img
772     src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
773   >Android NDK, Revision 10</a> <em>(July 2014)</em>
774 </p>
775 <div class="toggle-content-toggleme">
776    <dl>
777      <dt>Important changes:</dt>
778      <dd>
779      <ul>
780        <li>Added 3 new ABIs, all 64-bit: arm64-v8a, x86_64, mips64.</li> Note that:
781        <ul>
782           <li>GCC 4.9 is the default compiler for 64-bit ABIs. Clang is currently version 3.4.
783<code>NDK_TOOLCHAIN_VERSION=clang</code>
784      may not work for arm64-v8a and mips64.</li>
785           <li>Android-L is the first level with 64-bit support.  Note that this API
786level is a temporary one, and only for L-preview. An actual API level number will replace it at
787L-release.</li>
788           <li>This release includes now includes <code>all32</code> and <code>all64</code>
789settings for <code>APP_ABI</code>.
790              <ul>
791              <li><code>APP_ABI=all32</code> is equivalent to
792<code>APP_ABI=armeabi,armeabi-v7a,x86,mips</code>.</li>
793              <li><code>APP_ABI=all64</code> is equivalent to
794<code>APP_ABI=arm64-v8a,x86_64,mips64</code>.</li>
795              <li><code>APP_ABI=all</code> selects all ABIs.</li>
796              </ul>
797           <li>The new GNU libstdc++ in Android-L contains all <code>&lt;tr1/cmath&gt;</code>
798Before defining your own math function, check <code>_GLIBCXX_USE_C99_MATH_TR1</code> to see a
799function with that name already exists, in order to avoid "multiple definition" errors from the
800linker.</li>
801           <li>The cpu-features library has been updated for the ARMv8 kernel.  The existing
802cpu-features library may fail to detect the presence of NEON on the ARMv8 platform. Recompile your
803code with the new version.</li>
804        </ul>
805        <li>Added a new <code>platforms/android-L/</code> API directory. It includes:</li>
806        <ul>
807           <li>Updated Bionic headers, which had not changed from Android API levels 3
808(Cupcake) to 19 (KitKat). This new version, for level L, is to be synchronized with AOSP.</li>
809           <li>New media APIs and a native-codec sample.</li>
810           <li>An updated <code>Android.h</code> header for SLES/OpenSLES, enabling support for
811single-precision, floating-point audio format in AudioPlayer.</li>
812           <li>GLES 3.1 and AEP extensions to <code>libGLESv3.so.</code></li>
813           <li>GLES2 and GLES3 headers updated to the latest official Khronos versions.</li>
814        </ul>
815        <li>Added GCC 4.9 compilers to the 32-/64-bit ABIs.  GCC 4.9 is the default (only) compiler
816for 64-bit ABIs, as previously mentioned.  For 32-bit ABIs, you must explcitly enable GCC 4.9, as
817GCC 4.6 is still the default.</li>
818        <ul>
819           <li>For ndk-build, enable 32-bit, GCC 4.9 building either by adding
820<code>NDK_TOOLCHAIN_VERSION=4.9</code> to <code>Application.mk</code>, or exporting it as an
821environment variable from the command line.</li>
822           <li>For a standalone toolchain, use the <code>--toolchain=</code> option in the
823<code>make-standalone-toolchain.sh</code> script. For example: <code>--toolchain=arm-linux-androideabi-4.9.</code></li>
824        </ul>
825        <li>Upgraded GDB to version 7.6 in GCC 4.8/4.9 and x86*. Since GDB is still at version GDB-7.3.x in
826GCC 4.6 (the default for ARM and MIPS), you must set
827<code>NDK_TOOLCHAIN_VERSION=4.8</code> or <code>4.9</code> to enable ndk-gdb to select GDB 7.6.</li>
828        <li>Added the <code>-mssse3</code> build option to provide SSSE3 support, and made it the default for ABI x86
829(upgrading from SSE3). The image released by Google does not contain SSSE3 instructions.</li>
830        <li>Updated GCC 4.8 to 4.8.3.</li>
831        <li>Improved ARM libc++ EH support by switching from gabi++ to libc++abi. For details, see the "C++ Support" section of the documentation.
832  Note that:</li>
833        <ul>
834           <li>All tests except for locale now pass for Clang 3.4 and GCC 4.8. For more
835information, see the "C++ Support" section of the documentation.</li>
836           <li>The libc++ libraries for X86 and MIPS libc++ still use gabi++.</li>
837           <li>GCC 4.7 and later can now use &lt;atomic&gt;.</li>
838           <li>You must add <code>-fno-strict-aliasing</code> if you use <code> &lt;list&gt;</code>, because <code>__list_imp::_end</code>_ breaks
839      TBAA rules.  (Issue <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61571">61571</a>.)</li>
840           <li>As of GCC 4.6, LIBCXX_FORCE_REBUILD:=true no longer rebuilds libc++. Rebuilding it
841requires the use of a different compiler. Note that Clang 3.3 is untested.</li>
842        </ul>
843        <li>mclinker is now version 2.7, and has aarch64 Linux support.</li>
844        <li>Added precompiled header support for headers specified by <code>LOCAL_PCH</code>.  (Issue <a href="http://b.android.com/25412">25412</a>).</li>
845      </dd>
846   <dl>
847
848
849     <dt>Important bug fixes:</dt>
850     <dd>
851     <ul>
852       <li>Fixed libc++ so that it now compiles <code>std::feof</code>, etc. (Issue <a
853href="http://b.android.com/66668">66668</a>).</li>
854       <li>Fixed a Clang 3.3/3.4 atomic library call that caused crashes in some of the libc++
855tests for ABI armeabi.</li>
856       <li>Fixed Clang 3.4 crashes that were occurring on reading precompiled headers. (Issue <a
857href="http://b.android.com/66657">66657</a>).</li>
858       <li>Fixed the Clang 3.3/3.4 <code>-O3</code> assert on:</li>
859       <code>llvm-3.2/llvm/include/llvm/MDBuilder.h:64: llvm::MDNode*
860llvm::MDBuilder::createBranchWeights(llvm::ArrayRef<unsigned int>): Assertion Weights.size() >= 2
861&& "Need at least two branch weights!"</code> (Issue <a href="http://b.android.com/57381">57381</a>).
862       <li>Fixed the following Clang 3.3/3.4 crash:</li>
863       <code>Assertion failed: (!Fn && "cast failed but able to resolve overload expression!!"), function CheckCXXCStyleCast, file
864Volumes/data/ndk-toolchain/src/llvm-3.3/llvm/tools/clang/lib/Sema/SemaCast.cpp, line 2018</code>.
865(Issue <a href="http://b.android.com/66950">66950</a>).
866     </ul>
867     </dd>
868
869     <dt>Other bug fixes:</dt>
870     <dd>
871     <ul>
872       <li>Fixed headers:</li>
873       <ul>
874          <li>Fixed 32-bit <code>ssize_t</code> to be <code>int</code> instead of <code>long
875int</code>.</li>
876          <li>Fixed <code>WCHAR_MIN</code> and <code>WCHAR_MAX</code> so that they they take
877appropriate signs according to the architecture they're running on:</li>
878          <ul>
879             <li>X86/MIPS: signed.
880             <li>ARM: unsigned.
881             <li>To force X86/MIPS to default to unsigned, use
882<code>-D__WCHAR_UNSIGNED__</code>.</li>
883             <li>To force <code>wchar_t</code> to be 16 bits, use <code>-fshort-wchar</code>.</li>
884          </ul>
885          <li>Removed non-existent symbols from 32-bit <code>libc.so</code>, and added <code>pread64</code>,
886<code>pwrite64</code>, <code>ftruncate64</code> for
887Android API level 12 and higher. (Issue <a href="http://b.android.com/69319">69319</a>). For more
888information, see the commit message accompanying AOSP change list
889     <a href="https://android-review.googlesource.com/#/c/94137">94137</a>.</li>
890       </ul>
891       <li>Fixed GCC warning about redefinition of <code>putchar</code>. Warning message reads:</li>
892       <code>include/stdio.h:236:5: warning: conflicts with previous declaration here
893[-Wattributes] int  putchar(int);</code> (Change list <a
894href="https://android-review.googlesource.com/#/c/91185">91185</a>).
895       <li>Fixed <code>make-standalone-toolchain.sh --stl=libc++</code> so that it:</li>
896       <ul>
897          <li>Copies <code>cxxabi.h</code>. (Issue <a
898href="http://b.android.com/68001">68001</a>).</li>
899          <li>Runs in directories other than the NDK install directory. (Issues <a
900href="http://b.android.com/67690">67690</a> and <a href="http://b.android.com/68647">68647</a>).</li>
901       </ul>
902       <li>Fixed GCC/Windows to quote arguments only when necessary for spawning processes in
903external programs. This change decreases the likelihood of exceeding the 32K length limit.</li>
904       <li>Fixed an issue that made it impossible to adjust the <code>APP_PLATFORM</code>
905environment variable.</li>
906       <li>Fixed the implementation of <code>IsSystemLibrary()</code> in crazy_linker so that it
907uses <code>strrchr()</code>
908  instead of <code>strchr()</code> to find the library path's true basename.</li>
909       <li>Fixed native-audio's inability to build in debug mode.</li>
910       <li>Fixed gdb's inability to print extreme floating-point numbers. (Issue <a
911href="http://b.android.com/69203">69203</a>).</li>
912       <li>Fixed Clang 3.4 inability to compile with <code>-Wl,-shared</code> (as opposed to
913<code>-shared</code>, which
914  had no compilation issues).  The problem was that Clang added <code>-pie</code> for Android
915targets if neither <code>-shared</code> nor <code>-static</code> existed. This behavior, which was
916incorrect, caused the linker to complain that <code>-shared</code> and <code>-pie</code> could not
917co-exist.</li>
918
919     </ul>
920     </dd>
921
922
923     <dt>Other changes:</dt>
924     <dd>
925     <ul>
926        <li>Added <code>arm_neon.h</code> to the x86 toolchain so that it now emulates ~47% of
927Neon. There is currently no support for 64-bit types. For more information, see the section on ARM
928Neon intrinsics support in the x86 documentation.</li>
929        <li>Ported ARM/GOT_PREL optimization (present in GCC 4.6 built from the GCC google branch) to
930ARM GCC 4.8/4.9.  This optimization sometimes reduces instruction count when accessing global
931variables.  As an example, see the build.sh script in
932<code>$NDK/tests/build/b14811006-GOT_PREL-optimization/</code>.</li>
933        <li>Added ARM version for STL gabi++, stlport, and libc++. They now have both it and Thumb
934mode.</li>
935        <li>It is now possible to call the make-standalone-toolchain.sh script with
936<code>--toolchain=x86_64-linux-android-4.9</code>, which is equivalent to
937<code>--toolchain=x86_64-4.9</code>.</li>
938     </dd>
939     </ul>
940   </dl>
941 </div>
942</div>
943
944
945<div class="toggle-content closed">
946 <p>
947   <a href="#" onclick="return toggleContent(this)"> <img
948     src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
949   >Android NDK, Revision 9d</a> <em>(March 2014)</em>
950 </p>
951 <div class="toggle-content-toggleme">
952    <dl>
953      <dt>Important changes:</dt>
954      <dd>
955      <ul>
956        <li>Added support for the Clang 3.4 compiler. The
957<code>NDK_TOOLCHAIN_VERSION=clang</code> option now picks Clang 3.4. GCC 4.6 is
958still the default compiler.</li>
959        <li>Added <code>APP_ABI=armeabi-v7a-hard</code>, with
960additional multilib option <code>-mfloat-abi=hard</code>. These options are for
961use with ARM GCC 4.6/4.8 and Clang 3.3/3.4 (which use 4.8's assembler, linker,
962and libs). When using these options, note the following changes:</li>
963        <ul>
964           <li> When executing the <code>ndk-build</code> script, add the
965following options for armeabi-v7a target:
966<pre>TARGET_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1
967TARGET_LDFLAGS += -Wl,--no-warn-mismatch -lm_hard</pre>
968The built library is copied to <code>libs/armeabi-v7a</code>. For make to
969behave as expected, you cannot specify both <code>armeabi-v7a</code> and
970<code>armeabi-v7a-hard</code> as make targets (i.e., on the APP_ABI= line).
971Doing so causes one of them to be ignored. Note that <code>APP_ABI=all</code>
972is still equivalent to
973<code>armeabi armeabi-v7a x86 mips</code>.</li>
974           <li>The <code>make-standalone-toolchain.sh</code> script copies
975additional libaries under <code>/hard</code> directories.
976      Add the above <code>CFLAGS</code> and <code>LFLAGS</code> to your
977makefile to enable GCC or Clang to link with
978      libraries in <code>/hard</code>.</li>
979        </ul>
980        <li>Added the yasm assembler, as well as <code>LOCAL_ASMFLAGS</code>
981and <code>EXPORT_ASMFLAGS</code> flags for x86
982targets. The <code>ndk-build</code> script uses
983<code>prebuilts/*/bin/yasm*</code> to build <code>LOCAL_SRC_FILES</code> that
984have the <code>.asm</code> extension.</li>
985        <li>Updated MClinker to 2.6.0, which adds <code>-gc-sections</code>
986support.</li>
987        <li>Added experimental libc++ support (upstream r201101).  Use this new
988feature by following these steps:
989        <ul>
990           <li>Add <code>APP_STL := c++_static</code> or <code>APP_STL :=
991c++_shared</code> in <code>Application.mk</code>.
992      You may rebuild from source via <code>LIBCXX_FORCE_REBUILD :=
993true</code></li>
994           <li>Execute <code>make-standalone-toolchain.sh --stl=libc++</code>
995to create a standalone toolchain with libc++ headers/lib.</li>
996        </ul>
997        For more information, see
998<code>CPLUSPLUS-SUPPORT.html</code>.
999(Issue <a href="http://b.android.com/36496">36496</a>)</li>
1000      </ul>
1001      </dd>
1002   <dl>
1003     <dt>Important bug fixes:</dt>
1004     <dd>
1005     <ul>
1006       <li>Fixed an uncaught throw from an unexpected
1007exception handler for GCC 4.6/4.8 ARM EABI. (GCC Issue <a
1008href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59392">59392</a>)</li>
1009       <li>Fixed GCC 4.8 so that it now correctly resolves partial
1010specialization of a template with
1011  a dependent, non-type template argument. (GCC Issue <a
1012href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59052">59052</a>)</li>
1013       <li>Added more modules to prebuilt python (Issue <a
1014href="http://b.android.com/59902">59902</a>):
1015               <ul>
1016                 <li>Mac OS X: <code>zlib</code>, <code>bz2</code>,
1017<code>_curses</code>, <code>_curses_panel</code>, <code>_hashlib</code>,
1018<code>_ssl</code></li>
1019                 <li>Linux: <code>zlib</code>, <code>nis</code>,
1020<code>crypt</code>, <code>_curses</code>, and <code>_curses_panel</code></li>
1021               </ul>
1022       <li>Fixed the x86 and MIPS gdbserver
1023<code>event_getmsg_helper</code>.</li>
1024       <li>Fixed numerous issues in the RenderScript NDK toolchain, including
1025issues with compatibility across older devices and C++ reflection.</li>
1026<br>
1027     </ul>
1028     </dd>
1029
1030     <dt>Other bug fixes:</dt>
1031     <dd>
1032     <ul>
1033       <li>Header fixes:
1034         <ul>
1035           <li>Fixed a missing <code>#include &lt;sys/types.h&gt;</code> in
1036<code>android/asset_manager.h</code> for Android API level 13 and higher.
1037     (Issue <a href="http://b.android.com/64988">64988</a>)</li>
1038           <li>Fixed a missing <code>#include <stdint.h></code> in
1039<code>android/rect_manager.h</code> for Android API level 14 and higher.</li>
1040           <li>Added <code>JNICALL</code> to <code>JNI_OnLoad</code> and
1041<code>JNI_OnUnload</code> in <code>jni.h</code>. Note that <code>JNICALL</code>
1042 is defined as <code>__NDK_FPABI__</code> For more information, see
1043<code>sys/cdefs.h</code>.</li>
1044           <li>Updated the following headers so that they can be included
1045without the need to
1046manually include their dependencies (Issue <a
1047href="http://b.android.com/64679">64679</a>):</li>
1048<pre>
1049android/tts.h
1050EGL/eglext.h
1051fts.h
1052GLES/glext.h
1053GLES2/gl2ext.h
1054OMXAL/OpenMAXSL_Android.h
1055SLES/OpenSLES_Android.h
1056sys/prctl.h
1057sys/utime.h
1058</pre>
1059           <li>Added <code>sys/cachectl.h</code> for all architectures. MIPS
1060developers can now include this header instead of writing <code>#ifdef
1061__mips__</code>.</li>
1062           <li></code>Fixed <code>platforms/android-18/include/android/input.h
1063</code> by adding <code>__NDK_FPABI__</code> to functions taking or returning
1064float or double values.</li>
1065           <li>Fixed MIPS <code>struct stat</code>, which was incorrectly set
1066to its 64-bit counterpart for Android API level 12 and later. This wrong
1067setting was a
1068regression introduced in release r9c.</li>
1069           <li>Defined <code>__PTHREAD_MUTEX_INIT_VALUE</code>,
1070<code>__PTHREAD_RECURSIVE_MUTEX_INIT_VALUE</code>,
1071     and <code>__PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE</code> for Android API
1072level 9 and lower.</li>
1073           <li>Added <code>scalbln</code>, <code>scalblnf</code>, and
1074<code>scalblnl</code> to x86 <code>libm.so</code> for APIs 18 and later.</li>
1075           <li>Fixed a typo in
1076<code>sources/android/support/include/iconv.h</code>.
1077     (Issue <a href="http://b.android.com/63806">63806</a>)</li>
1078
1079         </ul>
1080       </li>
1081       <li>Fixed gabi++ <code>std::unexpected()</code> to call
1082<code>std::terminate()</code> so that
1083  a user-defined <code>std::terminate()</code> handler has a chance to run.
1084</li>
1085       <li>Fixed gabi++ to catch <code>std::nullptr</code>.</li>
1086       <li>Fixed samples Teapot and MoreTeapots:
1087         <ul>
1088      <li>Solved a problem with Tegra 2 and 3 chips by changing specular
1089variables to use medium precision. Values for specular power can now be less
1090than 1.0. </li>
1091      <li>Changed the samples so that pressing the volume button restores
1092immersive mode and invalidates
1093<code>SYSTEM_UI_FLAG_IMMERSIVE_STICKY</code>. Screen rotation does not
1094trigger <code>onSystemUiVisibilityChange</code>, and so does not restore
1095immersive mode.</li>
1096         </ul>
1097        </li>
1098        <li>Fixed the <code>ndk-build</code> script to add
1099<code>-rpath-link=$SYSROOT/usr/lib</code> and
1100<code>-rpath-link=$TARGET_OUT</code> in order to use <code>ld.bfd</code> to
1101link executables. (Issue  <a href="http://b.android.com/64266">64266</a>)</li>
1102        <li>Removed <code>-Bsymbolic</code> from all STL builds.</li>
1103        <li>Fixed <code>ndk-gdb-py.cmd</code> by setting <code>SHELL</code> as
1104an environment variable
1105instead of passing it to
1106  <code>python.exe</code>, which ignores the setting.
1107  (Issue <a href="http://b.android.com/63054">63054</a>)</li>
1108        <li>Fixed the <code>make-standalone-toolchain.sh</code> script so that
1109the <code>--stl=stlport</code> option copies the gabi++ headers instead of
1110symlinking them; the <code>cmd.exe</code> and MinGW shells do not understand
1111symlinks created by cygwin.</li>
1112     </ul>
1113     </dd>
1114
1115     <dt>Other changes:</dt>
1116     <dd>
1117     <ul>
1118        <li>Applied execution permissions to all <code>*cmd</code> scripts
1119previously intended for use only in the <code>cmd.exe</code> shell, in case
1120developers prefer to use <code>ndk-build.cmd</code> in cygwin instead of the
1121recommended <code>ndk-build</code> script.</li>
1122        <li>Improved the speed of the <code>make-standalone-toolchain.sh</code>
1123script by moving instead of copying if the specified destination directory does
1124not exist.</li>
1125     </dd>
1126     </ul>
1127   </dl>
1128 </div>
1129</div>
1130
1131<div class="toggle-content closed">
1132 <p>
1133   <a href="#" onclick="return toggleContent(this)"> <img
1134     src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
1135   >Android NDK, Revision 9c</a> <em>(December 2013)</em>
1136 </p>
1137 <div class="toggle-content-toggleme">
1138<p>This is a bug-fix-only release.</p>
1139   <dl>
1140     <dt>Important bug fixes:</dt>
1141     <dd>
1142     <ul>
1143       <li>Fixed a problem with GCC 4.8 ARM, in which the stack pointer is
1144restored too early. This problem prevented the frame pointer from reliably
1145accessing a variable in the stack frame. (GCC Issue <a
1146href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854">58854</a>)</li>
1147<li>Fixed a problem with GCC 4.8 libstdc++, in which a bug in
1148std::nth_element was causing generation of code that produced a random
1149segfault. (Issue <a
1150href="https://code.google.com/p/android/issues/detail?id=62910">62910</a>)</li>
1151           <li>Fixed GCC 4.8 ICE in cc1/cc1plus with
1152<code>-fuse-ld=mcld</code>, so that the following error no longer occurs:
1153<pre>cc1: internal compiler error: in common_handle_option, at
1154opts.c:1774</pre></li>
1155           <li>Fixed <code>-mhard-float</code> support for
1156<code>__builtin</code> math functions. For ongoing information on fixes for
1157<code>-mhard-float</code> with STL, please follow Issue <a
1158href="http://b.android.com/61784">61784</a>.</li>
1159     </ul>
1160     </dd>
1161
1162     <dt>Other bug fixes:</dt>
1163     <dd>
1164     <ul>
1165       <li>Header fixes:
1166         <ul>
1167           <li>Changed prototype of <code>poll</code> to <code>poll(struct
1168pollfd *, nfds_t, int);</code> in <code>poll.h</code>.</li>
1169           <li>Added <code>utimensat</code> to <code>libc.so</code> for Android
1170API levels 12 and 19. These libraries are now included for all Android API
1171levels 12 through 19.</li>
1172<li>Introduced <code>futimens</code> into <code>libc.so</code>, for Android API
1173level 19.</li>
1174<li>Added missing <code>clock_settime()</code> and
1175<code>clock_nanosleep()</code> to <code>time.h</code> for Android API level 8
1176and higher.</li>
1177<li>Added <code>CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE,
1178CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,</code> and
1179<code>CLOCK_BOOTTIME_ALARM</code> in <code>time.h.</code></li>
1180<li>Removed obsolete <code>CLOCK_REALTIME_HR</code> and
1181<code>CLOCK_MONOTONIC_HR.</code></li>
1182         </ul>
1183       </li>
1184       <li>In samples Teapot, MoreTeapots, and
1185<code>source/android/ndk_helper</code>:
1186         <ul>
1187<li>Changed them so that they now use a hard-float abi for armeabi-v7a.</li>
1188<li>Updated them to use immersive mode on Android API level 19 and
1189higher.</li>
1190<li>Fixed a problem with <code>Check_ReleaseStringUTFChars</code> in
1191<code>/system/lib/libdvm.so</code> that was causing crashes on x86 devices.</li>
1192         </ul>
1193        </li>
1194<li>Fixed <code>ndk-build</code> fails that happen in cygwin when the NDK
1195package is
1196referenced via symlink.</li>
1197<li>Fixed <code>ndk-build.cmd</code> fails that happen in windows
1198<code>cmd.exe</code> when
1199<code>LOCAL_SRC_FILES</code> contains absolute paths. (Issue <a
1200href="https://android-review.googlesource.com/#/c/69992">69992</a>)</li>
1201<li>Fixed the <code>ndk-stack</code> script to proceed even when it can't parse
1202a frame due to inability to find a routine, filename, or line number. In any of
1203these cases, it prints <code>??</code>.</li>
1204<li>Fixed the <code>ndk-stack</code> stack for windows-x64_64 targets so that
1205it no longer erroneously matches a frame line with a line in the
1206<code>stack:</code> section that doesn't contain <code>pc</code>,
1207<code>eip</code>, or <code>ip</code>. For example:
1208<pre>I/DEBUG   ( 1151):     #00  5f09db68  401f01c4
1209/system/lib/libc.so</pre></li>
1210<li>Fixed gabi++ so that it:
1211     <ul>
1212         <li>Does not use malloc() to allocate C++ thread-local
1213  objects.</li>
1214         <li>Avoids deadlocks in gabi++ in cases where libc.debug.malloc is
1215non-zero in userdebug/eng Android platform builds.</li>
1216     </ul>
1217     </ul>
1218     </dd>
1219
1220     <dt>Other changes:</dt>
1221     <dd>
1222     <ul>
1223       <li>Added <code>LOCAL_EXPORT_LDFLAGS</code>.</li>
1224<li>Introduced the <code>NDK_PROJECT_PATH=null</code> setting for use in an
1225integrated build system where options are explicitly passed to
1226<code>ndk-build</code>. With this setting, <code>ndk-build</code> makes no
1227attempt to look for <code>NDK_PROJECT_PATH.</code> This setting also prevents
1228variables from deriving default settings from NDK_PROJECT_PATH. As a result,
1229the following variables must now be explicitly specified (with their default
1230values if such exist): <code>NDK_OUT, NDK_LIBS_OUT, APP_BUILD_SCRIPT,
1231NDK_DEBUG</code> (optional, default to 0), and other <code>APP_*</code>'s
1232contained in <code>Application.mk</code>.</li>
1233<li><code>APP_ABI</code> can now be enumerated in a comma-delimited list. For
1234example:
1235<pre>APP_ABI := "armeabi,armeabi-v7a"</pre></li>
1236<li>Provided the ability to rebuild all of STL with debugging info in an
1237optional, separate package called
1238<code>android-ndk-r9c-cxx-stl-libs-with-debugging-info.zip</code>, using the
1239<code>-g</code> option. This option
1240helps the <code>ndk-stack</code> script provide better a stack dump across STL.
1241This change should not affect the code/size of the final, stripped file.</li>
1242<li>Enhanced <code>hello-jni</code> samples to report <code>APP_ABI</code> at
1243compilation.</li>
1244<li>Used the <code>ar</code> tool in Deterministic mode (option
1245<code>-D</code>) to build static libraries.  (Issue <a
1246href="http://b.android.com/60705">60705</a>)</li>
1247     </ul>
1248     </dd>
1249
1250   </dl>
1251 </div>
1252</div>
1253
1254<div class="toggle-content closed">
1255  <p>
1256    <a href="#" onclick="return toggleContent(this)"> <img
1257      src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt=""
1258    >Android NDK, Revision 9b</a> <em>(October 2013)</em>
1259  </p>
1260  <div class="toggle-content-toggleme">
1261    <dl>
1262      <dt>Important changes:</dt>
1263      <dd>
1264      <ul>
1265        <li>Updated {@code include/android/*h} and {@code math.h} for all Android API levels up to
1266          18, including the addition of levels 13, 15, 16 and 17.
1267          For information on added APIs, see commit messages for Changes
1268          <a href="https://android-review.googlesource.com/68012">68012</a> and
1269          <a href="https://android-review.googlesource.com/68014">68014</a>.
1270          (Issues <a href="http://b.android.com/47150">47150</a>,
1271           <a href="http://b.android.com/58528">58528</a>, and
1272           <a href="http://b.android.com/38423">38423</a>)</li>
1273        <li>Added support for Android API level 19, including Renderscript binding.</li>
1274        <li>Added support for <code>-mhard-float</code> in the existing armeabi-v7a ABI. For more
1275          information and current restrictions on Clang, see
1276          {@code tests/device/hard-float/jni/Android.mk}.</li>
1277        <li>Migrated from GNU Compiler Collection (GCC) 4.8 to 4.8.2, and added diagnostic color
1278          support. To enable diagnostic colors, set <code>-fdiagnostics-color=auto</code>,
1279          <code>-fdiagnostics-color=always,</code> or export {@code GCC_COLORS} as shown below:
1280<pre>
1281GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
1282</pre>
1283          For more information, see
1284          <a href="http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html">GCC
1285          Language Independent Options</a>.
1286        </li>
1287        <li>Added two new samples to demonstrate OpenGL ES 3.0 features: Teapot and MoreTeapots.
1288          These samples run on devices with Android 4.1 (API level 16) and higher.</li>
1289        <li>Deprecated GCC 4.7 and Clang 3.2 support, which will be removed in the next
1290          release.</li>
1291      </ul>
1292      </dd>
1293
1294      <dt>Important bug fixes:</dt>
1295      <dd>
1296      <ul>
1297        <li>Fixed problem with ARM GCC 4.6 {@code thumb2} failing to generate 16-bit relative jump
1298          tables. (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48328">GCC Issue</a>)</li>
1299        <li>Fixed GCC 4.8 internal compiler error (ICE) on
1300          {@code g++.dg/cpp0x/lambda/lambda-defarg3.C}.
1301          (<a href="https://android-review.googlesource.com/62770">Change 62770</a>,
1302          <a href="http://gcc.gnu.org/ml/gcc/2013-07/msg00424.html">GCC Issue</a>)</li>
1303        <li>Fixed a problem with Windows 32-bit {@code *-gdb.exe} executables failing to launch.
1304          (<a href="http://b.android.com/58975">Issue 58975</a>)</li>
1305        <li>Fixed GCC 4.8 ICE when building bullet library. The error message is as follows:
1306          <pre>internal compiler error: verify_flow_info failed</pre>
1307          (<a href="http://b.android.com/58916">Issue 58916</a>,
1308           <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58165">GCC Issue</a>)</li>
1309        <li>Modified GDB/ARM build to skip {@code ARM.exidx} data for unwinding in prologue code and
1310          added a command ({@code set arm exidx-unwinding}) to control exidx-based stack unwinding.
1311          (<a href="http://b.android.com/55826">Issue 55826</a>)</li>
1312        <li>Fixed Clang 3.3 MIPS compiler problem where HI and LO registers are incorrectly
1313          reused.</li>
1314        <li>Fixed issue with MIPS 4.7 ICE in {@code dbx_reg_number}. The error message is as
1315follows:
1316<pre>
1317external/icu4c/i18n/decimfmt.cpp:1322:1:
1318internal compiler error: in dbx_reg_number, at dwarf2out.c:10185
1319</pre>
1320          (<a href="http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00830.html">GCC Patch</a>)
1321
1322        </li>
1323
1324      </ul>
1325      </dd>
1326
1327      <dt>Other bug fixes:</dt>
1328      <dd>
1329      <ul>
1330        <li>Header fixes
1331          <ul>
1332            <li>Fixed the ARM {@code WCHAR_MIN} and {@code WCHAR_MAX} to be unsigned according to
1333              spec (the X86/MIPS versions are signed). Define {@code _WCHAR_IS_ALWAYS_SIGNED} to
1334              restore old behavior. (<a href="http://b.android.com/57749">Issue 57749</a>)</li>
1335            <li>Fixed {@code include/netinet/tcp.h} to contain {@code TCP_INFO} state enum.
1336              (<a href="http://b.android.com/38881">Issue 38881</a>)</li>
1337            <li>Fixed the {@code cdefs_elh.h} macro {@code _C_LABEL_STRING} to stop generating
1338               warnings in the GCC 4.8 toolchain when using c++11 mode.
1339              (<a href="http://b.android.com/58135">Issue 58135</a>,
1340               <a href="http://b.android.com/58652">Issue 58652</a>)</li>
1341            <li>Removed non-existent functions {@code imaxabs} and {@code imaxdiv} from header
1342              {@code inttypes.h}.</li>
1343            <li>Fixed issue with {@code pthread_exit()} return values and {@code pthread_self()}.
1344                 (<a href="http://b.android.com/60686">Issue 60686</a>)</li>
1345            <li>Added missing {@code mkdtemp()} function, which already exists in {@code bionic}
1346              header {@code stdlib.h}.</li>
1347          </ul>
1348        </li>
1349        <li>Fixed problem building {@code samples/gles3jni} with Clang on Android API level 11.</li>
1350        <li>Fixed MCLinker to allow multiple occurrences of the following options:
1351          {@code -gc-sections} and {@code --eh-frame-hdr}.</li>
1352        <li>Fixed MCLinker to accept the {@code --no-warn-mismatch} option.</li>
1353        <li>Modified {@code cpu-features} option to not assume all VFPv4 devices support IDIV.
1354          Now this option only adds IDIV to white-listed devices, including Nexus 4.
1355          (<a href="http://b.android.com/57637">Issue 57637</a>)</li>
1356        <li>Fixed problem with {@code android_native_app_glue.c} erroneously logging errors on event
1357          predispatch operations.</li>
1358        <li>Fixed all operations on {@code gabi++} terminate and unexpected_handler to be
1359          thread-safe.</li>
1360        <li>Fixed several issues with Clang <code>-integrated-as</code> option so it can pass
1361          tests for {@code ssax-instructions} and {@code fenv}.</li>
1362        <li>Fixed GCC 4.6/4.7/4.8 compiler to pass the linker option {@code --eh-frame-hdr} even
1363          for static executables. For more information, see the
1364          <a href="http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00969.html">GCC patch</a>.</li>
1365        <li>Fixed extra apostrophe in <code>CPU-ARCH-ABIS.html</code>. For more information, see
1366          <code>NDK-DEPENDS.html</code>. (<a href="http://b.android.com/60142">Issue 60142</a>)</li>
1367        <li>Fixed extra quotes in ndk-build output on Windows.
1368          (<a href="http://b.android.com/60649">Issue 60649</a>)</li>
1369        <li>Fixed Clang 3.3 to compile ARM's built-in, atomic operations such as
1370          {@code __atomic_fetch_add}, {@code __atomic_fetch_sub}, and {@code __atomic_fetch_or}.
1371          </li>
1372        <li>Fixed Clang 3.3 ICE with customized {@code vfprintf}.
1373          (<a href="http://llvm.org/bugs/show_bug.cgi?id=16344">Clang issue</a>)
1374        </li>
1375      </ul>
1376      </dd>
1377
1378      <dt>Other changes:</dt>
1379      <dd>
1380      <ul>
1381        <li>Enabled OpenMP for all GCC builds. To use this feature, add the following flags to your
1382          build settings:
1383<pre>
1384LOCAL_CFLAGS += -fopenmp
1385LOCAL_LDFLAGS += -fopenmp
1386</pre>
1387          For code examples, see {@code tests/device/test-openmp}</li>
1388        <li>Reduced the size of {@code ld.mcld} significantly (1.5MB vs. {@code ld.bfd} 3.5MB and
1389          {@code ld.gold} 7.5MB), resulting in a speed improvement of approximately 20%.</li>
1390        <li>Added <code>LOCAL_CONLYFLAGS</code> and <code>APP_CONLYFLAGS</code> to specify
1391          options applicable to C only but not C++. The existing <code>LOCAL_CFLAGS</code>
1392          and <code>APP_CFLAGS</code> are also used for C++ compilation (to save trouble of
1393          specifying most options twice), so options such as <code>-std=gnu99</code> may fail in
1394          g++ builds with a warning and clang++ builds with an error.</li>
1395        <li>Added {@code gabi++} array helper functions.</li>
1396        <li>Modified GCC builds so that all {@code libgcc.a} files are built with
1397          <code>-funwind-tables</code> to allow the stack to be unwound past previously blocked
1398          points, such as <code>__aeabi_idiv0</code>.</li>
1399        <li>Added Ingenic MXU support in MIPS GCC4.6/4.7/4.8 with new <code>-mmxu</code>
1400option.</li>
1401        <li>Extended MIPS GCC4.6/4.7/4.8 <code>-mldc1-sdc1</code> to control ldxc1/sdxc1 too</li>
1402        <li>Added crazy linker. For more information, see
1403          {@code sources/android/crazy_linker/README.TXT}.</li>
1404        <li>Fixed {@code bitmap-plasma} to draw to full screen rather than a 200x200 pixel
1405area.</li>
1406        <li>Reduced linux and darwin toolchain sizes by 25% by creating symlinks to identical files.
1407          </li>
1408      </ul>
1409      </dd>
1410
1411    </dl>
1412  </div>
1413</div>
1414
1415
1416<div class="toggle-content closed">
1417  <p>
1418    <a href="#" onclick="return toggleContent(this)"> <img
1419      src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt=""
1420    >Android NDK, Revision 9</a> <em>(July 2013)</em>
1421  </p>
1422  <div class="toggle-content-toggleme">
1423    <dl>
1424      <dt>Important changes:</dt>
1425      <dd>
1426        <ul>
1427          <li>Added support for Android 4.3 (API level 18). For more information, see
1428            {@code STABLE-APIS.html} and new code examples in {@code samples/gles3jni/README}.
1429          <li>Added headers and libraries for OpenGL ES 3.0, which is supported by Android 4.3
1430            (API level 18) and higher.</li>
1431          <li>Added GNU Compiler Collection (GCC) 4.8 compiler to the NDK. Since GCC 4.6 is still
1432            the default, you must explicitly enable this option:
1433            <ul>
1434              <li>For {@code ndk-build} builds, export {@code NDK_TOOLCHAIN_VERSION=4.8} or
1435                add it in {@code Application.mk}.</li>
1436              <li>For standalone builds, use the {@code --toolchain=} option in
1437                {@code make-standalone-toolchain.sh}, for example:<br>
1438                {@code --toolchain=arm-linux-androideabi-4.8}</li>
1439            </ul>
1440            <p class="note"><strong>Note:</strong>
1441            The {@code -Wunused-local-typedefs} option is enabled by {@code -Wall}. Be
1442            sure to add {@code __attribute__((unused))} if you use compile-time asserts like
1443            {@code sources/cxx-stl/stlport/stlport/stl/config/features.h}, line #311. For more
1444            information, see
1445            <a href="https://android-review.googlesource.com/#/c/55460">Change 55460</a></p>
1446            <p class="note"><strong>Note:</strong>
1447            In the GCC 4.7 release and later, ARM compilers generate unaligned access code by
1448            default for ARMv6 and higher build targets. You may need to add the
1449            {@code -mno-unaligned-access} build option when building for kernels that do not support
1450            this feature.</p>
1451          </li>
1452          <li>Added Clang 3.3 support. The {@code NDK_TOOLCHAIN_VERSION=clang} build option
1453            now picks Clang 3.3 by default.
1454            <p class="note"><strong>Note:</strong>
1455             Both GCC 4.4.3 and Clang 3.1 are deprecated, and will be removed from the next NDK
1456             release.</p></li>
1457          <li>Updated GNU Project Debugger (GDB) to support python 2.7.5.</li>
1458          <li>Added MCLinker to support Windows hosts. Since {@code ld.gold}
1459            is the default where available, you must add {@code -fuse-ld=mcld} in
1460            {@code LOCAL_LDFLAGS} or {@code APP_LDFLAGS} to enable MCLinker.</li>
1461          <li>Added {@code ndk-depends} tool which prints ELF library dependencies.
1462            For more information, see {@code NDK-DEPENDS.html}.
1463            (<a href="http://b.android.com/53486">Issue 53486</a>)</li>
1464        </ul>
1465      </dd>
1466
1467      <dt>Important bug fixes:</dt>
1468      <dd>
1469        <ul>
1470          <li>Fixed potential event handling issue in {@code android_native_app_glue}.
1471            (<a href="http://b.android.com/41755">Issue 41755</a>)</li>
1472          <li>Fixed ARM/GCC-4.7 build to generate sufficient alignment for NEON load and store
1473            instructions VST and VLD.
1474            (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57271">GCC Issue 57271</a>)</li>
1475          <li>Fixed a GCC 4.4.3/4.6/4.7 internal compiler error (ICE) for a constant negative index
1476            value on a string literal.
1477            (<a href="http://b.android.com/54623">Issue 54623</a>)</li>
1478          <li>Fixed GCC 4.7 segmentation fault for constant initialization with an object address.
1479            (<a href="http://b.android.com/56508">Issue 56508</a>)</li>
1480          <li>Fixed GCC 4.6 ARM segmentation fault for <code>-O</code> values when using Boost
1481            1.52.0. (<a href="http://b.android.com/42891">Issue 42891</a>)
1482          <li>Fixed {@code libc.so} and {@code libc.a} to support the {@code wait4()} function.
1483            (<a href="http://b.android.com/19854">Issue 19854</a>)</li>
1484          <li>Updated the x86 libc.so and libc.a files to include the {@code clone()}
1485            function.</li>
1486          <li>Fixed {@code LOCAL_SHORT_COMMANDS} bug where the {@code linker.list} file is
1487            empty or not used.</li>
1488          <li>Fixed GCC MIPS build on Mac OS to use CFI directives, without which
1489            {@code ld.mcld --eh-frame-hdr} fails frequently.</li>
1490          <li>Fixed Clang 3.2 X86/MIPS internal compiler error in {@code llvm/lib/VMCore/Value.cpp}.
1491            (<a href="https://android-review.googlesource.com/#/c/59021">Change 59021</a>)</li>
1492          <li>Fixed GCC 4.7 64-bit Windows assembler crash. (Error: {@code out of memory allocating
1493            4294967280 bytes}).</li>
1494          <li>Updated {@code ndk-gdb} script so that the {@code --start} or {@code --launch} actions
1495            now wait for the GNU Debug Server, so that it can more reliably hit breakpoints set
1496            early in the execution path (such as breakpoints in JNI code).
1497            (<a href="http://b.android.com/41278">Issue 41278</a>)
1498            <p class="note"><strong>Note:</strong>
1499              This feature requires jdb and produces warning about pending breakpoints.
1500              Specify the {@code --nowait} option to restore previous behavior.
1501            </p>
1502          </li>
1503          <li>Fixed GDB crash when library list is empty.</li>
1504          <li>Fixed GDB crash when using a {@code stepi} command past a {@code bx pc} or
1505            {@code blx pc} Thumb instruction.
1506            (<a href="http://b.android.com/56962">Issue 56962</a>,
1507             <a href="http://b.android.com/36149">Issue 36149</a>)</li>
1508          <li>Fixed MIPS {@code gdbserver} to look for {@code DT_MIPS_RLD_MAP} instead of
1509            {@code DT_DEBUG}. (<a href="http://b.android.com/56586">Issue 56586</a>)</li>
1510          <li>Fixed a circular dependency in the ndk-build script, for example: If A-&gt;B and
1511            B-&gt;B, then B was dropped from build.
1512            (<a href="http://b.android.com/56690">Issue 56690</a>)</li>
1513        </ul>
1514      </dd>
1515
1516      <dt>Other bug fixes:</dt>
1517      <dd>
1518        <ul>
1519          <li>Fixed the {@code ndk-build} script to enable you to specify a version of Clang as a
1520            command line option (e.g., {@code NDK_TOOLCHAIN_VERSION=clang3.2}). Previously, only
1521            specifying the version as an environment variable worked.</li>
1522          <li>Fixed gabi++ size of {@code _Unwind_Exception} to be 24 for MIPS build targets when
1523            using the Clang compiler.
1524            (<a href="https://android-review.googlesource.com/#/c/54141">Change 54141</a>)</li>
1525          <li>Fixed the {@code ndk-build} script to ensure that built libraries are actually
1526            removed from projects that include prebuilt static libraries when using the
1527            {@code ndk-build clean} command.
1528            (<a href="https://android-review.googlesource.com/#/c/54461">Change 54461</a>,
1529             <a href="https://android-review.googlesource.com/#/c/54480">Change 54480</a>)</li>
1530          <li>Modified the {@code NDK_ANALYZE=1} option to be less verbose.</li>
1531          <li>Fixed {@code gnu-libstdc++/Android.mk} to include a {@code backward/} path for builds
1532            that use backward compability.
1533            (<a href="http://b.android.com/53404">Issue 53404</a>)</li>
1534          <li>Fixed a problem where {@code stlport new} sometimes returned random values.</li>
1535          <li>Fixed {@code ndk-gdb} to match the order of {@code CPU_ABIS}, not {@code APP_ABIS}.
1536            (<a href="http://b.android.com/54033">Issue 54033</a>)</li>
1537          <li>Fixed a problem where the NDK 64-bit build on MacOSX choses the wrong path for
1538            compiler.
1539            (<a href="http://b.android.com/53769">Issue 53769</a>)</li>
1540          <li>Fixed build scripts to detect 64-bit Windows Vista.
1541            (<a href="http://b.android.com/54485">Issue 54485</a>)</li>
1542          <li>Fixed x86 {@code ntonl/swap32} error: {@code invalid 'asm': operand number
1543            out of range}.
1544            (<a href="http://b.android.com/54465">Issue 54465</a>,
1545             <a href="https://android-review.googlesource.com/#/c/57242">Change 57242</a>)</li>
1546          <li>Fixed {@code ld.gold} to merge string literals.</li>
1547          <li>Fixed {@code ld.gold} to handle large symbol alignment.</li>
1548          <li>Updated {@code ld.gold} to enable the {@code --sort-section=name} option.</li>
1549          <li>Fixed GCC 4.4.3/4.6/4.7 to suppress the {@code -export-dynamic} option for
1550            statically linked programs. GCC no longer adds an {@code .interp} section for statically
1551            linked programs.</li>
1552          <li>Fixed GCC 4.4.3 {@code stlport} compilation error about inconsistent {@code typedef}
1553            of {@code _Unwind_Control_Block}.
1554            (<a href="http://b.android.com/54426">Issue 54426</a>)</li>
1555          <li>Fixed {@code awk} scripts to handle {@code AndroidManifest.xml} files created on
1556            Windows which may contain trailing {@code \r} characters and cause build errors.
1557            (<a href="http://b.android.com/42548">Issue 42548</a>)</li>
1558          <li>Fixed {@code make-standalone-toolchain.sh} to probe the {@code prebuilts/}
1559            directory to detect if the host is 32 bit or 64 bit.</li>
1560          <li>Fixed the Clang 3.2 {@code -integrated-as} option.</li>
1561          <li>Fixed the Clang 3.2 ARM EHABI compact model {@code pr1} and {@code pr2} handler data.
1562            </li>
1563          <li>Added Clang {@code -mllvm -arm-enable-ehabi} option to fix the following Clang error:
1564            <pre>clang: for the -arm-enable-ehabi option: may only occur zero or one times!</pre>
1565            </li>
1566          <li>Fixed build failure when there is no {@code uses-sdk} element in application
1567            manifest. (<a href="http://b.android.com/57015">Issue 57015</a>)</li>
1568        </ul>
1569
1570      </dd>
1571      <dt>Other changes:</dt>
1572      <dd>
1573        <ul>
1574          <li>Header Fixes
1575            <ul>
1576              <li>Modified headers to make {@code __set_errno} an inlined function, since
1577                {@code __set_errno} in {@code errno.h} is deprecated, and {@code libc.so} no longer
1578                exports it.</li>
1579              <li>Modified {@code elf.h} to include {@code stdint.h}.
1580                (<a href="http://b.android.com/55443">Issue 55443</a>)</li>
1581              <li>Fixed {@code sys/un.h} to be included independently of other headers.
1582                (<a href="http://b.android.com/53646">Issue 53646</a>)</li>
1583              <li>Fixed all of the {@code MotionEvent_getHistorical} API family to take the
1584                {@code const AInputEvent* motion_event}.
1585                (<a href="http://b.android.com/55873">Issue 55873</a>)</li>
1586              <li>Fixed {@code malloc_usable_size} to take {@code const void*}.
1587                (<a href="http://b.android.com/55725">Issue 55725</a>)</li>
1588              <li>Fixed stdint.h to be more compatible with C99.
1589                (<a href="https://android-review.googlesource.com/#/c/46821">Change 46821</a>)</li>
1590              <li>Modified {@code wchar.h} to not redefine {@code WCHAR_MAX} and
1591                {@code WCHAR_MIN}</li>
1592              <li>Fixed {@code &lt;inttypes.h&gt;} declaration for pointer-related {@code PRI} and
1593                {@code SCN} macros. (<a href="http://b.android.com/57218">Issue 57218</a>)</li>
1594              <li>Changed the {@code sys/cdefs.h} header so that {@code __WCHAR_TYPE__} is 32-bit
1595                for API levels less than 9, which means that {@code wchat_t} is 32-bit for all
1596                API levels. To restore the previous behavior, define the {@code _WCHAR_IS_8BIT}
1597                boolean variable. (<a href="http://b.android.com/57267">Issue 57267</a>)</li>
1598            </ul>
1599          </li>
1600          <li>Added more formatting in NDK {@code docs/} and miscellaneous documentation fixes.
1601            </li>
1602          <li>Added support for a thin archive technique when building static libraries.
1603            (<a href="http://b.android.com/40303">Issue 40303</a>)</li>
1604          <li>Updated script {@code make-standalone-toolchain.sh} to support the {@code stlport}
1605            library in addition to {@code gnustl}, when you specify the option
1606            {@code --stl=stlport}. For more information, see {@code STANDALONE-TOOLCHAIN.html}.</li>
1607          <li>Updated the {@code make-standalone-toolchain.sh} script so that the
1608            {@code --llvm-version=} option creates the {@code $TOOLCHAIN_PREFIX-clang} and
1609            {@code $TOOLCHAIN_PREFIX-clang++} scripts in addition to {@code clang} and
1610            {@code clang++}, to avoid using the host's clang and clang++ definitions by accident.
1611            </li>
1612          <li>Added two flags to re-enable two optimizations in upstream Clang but disabled in
1613              NDK for better compatibility with code compiled by GCC:
1614            <ul>
1615              <li>Added a {@code -fcxx-missing-return-semantics} flag to re-enable <em>missing
1616return
1617                semantics</em> in Clang 3.2+. Normally, all paths should terminate with a return
1618                statement for a value-returning function. If this is not the case, clang inserts
1619                an undefined instruction (or trap in debug mode) at the path without a return
1620                statement. If you are sure your code is correct, use this flag to allow the
1621                optimizer to take advantage of the undefined behavior. If you are not sure, do not
1622                use this flag. The caller may still receive a random incorrect value, but the
1623                optimizer will not exploit it and make your code harder to debug.</li>
1624              <li>Added a {@code -fglobal-ctor-const-promotion} flag to re-enable
1625                promoting global variables with static constructor to be constants. With this flag,
1626                the global variable optimization pass of LLVM tries to evaluate the global
1627                variables with static constructors and promote them to global constants. Although
1628                this optimization is correct, it may cause some incompatability with code compiled
1629                by GCC. For example, code may do {@code const_cast} to cast the constant to mutable
1630                and modify it. In GCC, the variable is in read-write and the code is run by
1631                accident. In Clang, the const variable is in read-only memory and may cause your
1632                application to crash.</li>
1633            </ul>
1634          </li>
1635          <li>Added {@code -mldc1-sdc1} to the MIPS GCC and Clang compilers. By default, compilers
1636            align 8-byte objects properly and emit the {@code ldc1} and {@code sdc1} instructions
1637            to move them around. If your app uses a custom allocator that does not always align
1638            with a new object's 8-byte boundary in the same way as the default allocator, your app
1639            may crash due to {@code ldc1} and {@code sdc1} operations on unaligned memory. In this
1640            case, use the {@code -mno-ldc1-sdc1} flag to workaround the problem.</li>
1641          <li>Downgraded the event severity from warning to info if {@code APP_PLATFORM_LEVEL} is
1642            larger than {@code APP_MIN_PLATFORM_LEVEL}. The {@code APP_PLATFORM_LEVEL} may be lower
1643            than {@code APP_PLATFORM} in {@code jni/Application.mk} because the NDK does not have
1644            headers for all levels. In this case, the actual level is shifted downwards. The
1645            {@code APP_MIN_PLATFORM_LEVEL} is specified by the {@code android:minSdkVersion} in
1646            your application's manifest.
1647            (<a href="http://b.android.com/39752">Issue 39752</a>)</li>
1648          <li>Added the {@code android_getCpuIdArm()} and {@code android_setCpuArm()} methods to
1649            {@code cpu-features.c}. This addition enables easier retrieval of the ARM CPUID
1650            information. (<a href="http://b.android.com/53689">Issue 53689</a>)</li>
1651          <li>Modified {@code ndk-build} to use GCC 4.7's {@code as/ld} for Clang compiling.
1652            <p class="note"><strong>Note:</strong>
1653              In GCC 4.7, {@code monotonic_clock} and {@code is_monotonic} have been renamed to
1654              {@code steady_clock} and {@code is_steady}, respectively.</p></li>
1655          <li>Added the following new warnings to the {@code ndk-build} script:
1656            <ul>
1657              <li>Added warnings if {@code LOCAL_LDLIBS/LDFLAGS} are used in static library
1658                modules.</li>
1659              <li>Added a warning if a configuration has no module to build.</li>
1660              <li>Added a warning for non-system libraries being used in
1661                {@code LOCAL_LDLIBS/LDFLAGS} of a shared library or executable modules.</li>
1662            </ul>
1663          </li>
1664          <li>Updated build scripts, so that if {@code APP_MODULES} is not defined and only static
1665            libraries are listed in {@code Android.mk}, the script force-builds all of them.
1666            (<a href="http://b.android.com/53502">Issue 53502</a>)</li>
1667          <li>Updated {@code ndk-build} to support absolute paths in {@code LOCAL_SRC_FILES}.</li>
1668          <li>Removed the {@code *-gdbtui} executables, which are duplicates of the {@code *-gdb}
1669            executables with the {@code -tui} option enabled.</li>
1670          <li>Updated the build scripts to warn you when the Edison Design Group (EDG) compiler
1671            front-end turns {@code _STLP_HAS_INCLUDE_NEXT} back on.
1672            (<a href="http://b.android.com/53646">Issue 53646</a>)</li>
1673          <li>Added the environment variable {@code NDK_LIBS_OUT} to allow overriding of the
1674            path for {@code libraries/gdbserver} from the default {@code $PROJECT/libs}.
1675            For more information, see {@code OVERVIEW.html}.</li>
1676          <li>Changed ndk-build script defaults to compile code with format string protection
1677            {@code -Wformat -Werror=format-security}. You may set
1678            {@code LOCAL_DISABLE_FORMAT_STRING_CHECKS=true} to disable it.
1679            For more information, see {@code ANDROID-MK.html}</li>
1680          <li>Added STL pretty-print support in {@code ndk-gdb-py}. For more information, see
1681            {@code NDK-GDB.html}.</li>
1682          <li>Added tests based on the googletest frameworks.</li>
1683          <li>Added a notification to the toolchain build script that warns you if the current shell
1684            is not {@code bash}.</li>
1685        </ul>
1686      </dd>
1687    </dl>
1688  </div>
1689</div>
1690
1691
1692<div class="toggle-content closed">
1693  <p><a href="#" onclick="return toggleContent(this)">
1694    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
1695      alt="">Android NDK, Revision 8e</a> <em>(March 2013)</em>
1696  </p>
1697
1698  <div class="toggle-content-toggleme">
1699    <dl>
1700      <dt>Important changes:</dt>
1701      <dd>
1702        <ul>
1703          <li>Added 64-bit host toolchain set (package name suffix {@code *-x86_64.*}). For more
1704            information, see {@code CHANGES.HTML} and {@code NDK-BUILD.html}.</li>
1705          <li>Added Clang 3.2 compiler. GCC 4.6 is still the default. For information on using the
1706            Clang compiler, see {@code CHANGES.HTML}.</li>
1707          <li>Added static code analyzer for Linux/MacOSX hosts. For information on using the
1708            analyzer, see {@code CHANGES.HTML}.</li>
1709          <li>Added MCLinker for Linux/MacOSX hosts as an experimental feature. The {@code ld.gold}
1710            linker is the default where available, so you must explicitly enable it. For more
1711            information, see {@code CHANGES.HTML}.</li>
1712          <li>Updated ndk-build to use topological sort for module dependencies, which means the
1713            build automatically sorts out the order of libraries specified in
1714            {@code LOCAL_STATIC_LIBRARIES}, {@code LOCAL_WHOLE_STATIC_LIBRARIES} and
1715            {@code LOCAL_SHARED_LIBRARIES}. For more information, see {@code CHANGES.HTML}.
1716            (<a href="http://b.android.com/39378">Issue 39378</a>)</li>
1717        </ul>
1718      </dd>
1719
1720      <dt>Important bug fixes:</dt>
1721      <dd>
1722        <ul>
1723          <li>Fixed build script to build all toolchains in {@code -O2}. Toolchains in previous
1724            releases were incorrectly built without optimization.</li>
1725          <li>Fixed build script which unconditionally builds Clang/llvm for MacOSX in 64-bit.</li>
1726          <li>Fixed GCC 4.6/4.7 internal compiler error:
1727            {@code gen_thumb_movhi_clobber at config/arm/arm.md:5832}.
1728            (<a href="http://b.android.com/52732">Issue 52732</a>)</li>
1729          <li>Fixed build problem where GCC/ARM 4.6/4.7 fails to link code using 64-bit atomic
1730            built-in functions.
1731            (<a href="http://b.android.com/41297">Issue 41297</a>)</li>
1732          <li>Fixed GCC 4.7 linker DIV usage mismatch errors.
1733          (<a href="http://sourceware.org/ml/binutils/2012-12/msg00202.html">Sourceware Issue</a>)
1734          <li>Fixed GCC 4.7 internal compiler error {@code build_data_member_initialization, at
1735            cp/semantics.c:5790}.</li>
1736          <li>Fixed GCC 4.7 internal compiler error {@code redirect_eh_edge_1, at tree-eh.c:2214}.
1737            (<a href="http://b.android.com/52909">Issue 52909</a>)</li>
1738          <li>Fixed a GCC 4.7 segfault.
1739            (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245">GCC Issue</a>)</li>
1740          <li>Fixed {@code &lt;chrono&gt;} clock resolution and enabled {@code steady_clock}.
1741            (<a href="http://b.android.com/39680">Issue 39680</a>)</li>
1742          <li>Fixed toolchain to enable {@code _GLIBCXX_HAS_GTHREADS} for GCC 4.7 libstdc++.
1743            (<a href="http://b.android.com/41770">Issue 41770</a>,
1744             <a href="http://b.android.com/41859">Issue 41859</a>)</li>
1745          <li>Fixed problem with the X86 MXX/SSE code failing to link due to missing
1746            {@code posix_memalign}.
1747            (<a href="https://android-review.googlesource.com/#/c/51872">Change 51872</a>)</li>
1748          <li>Fixed GCC4.7/X86 segmentation fault in {@code i386.c}, function
1749            {@code distance_non_agu_define_in_bb()}.
1750            (<a href="https://android-review.googlesource.com/#/c/50383">Change 50383</a>)</li>
1751          <li>Fixed GCC4.7/X86 to restore earlier {@code cmov} behavior.
1752            (<a href="http://gcc.gnu.org/viewcvs?view=revision&revision=193554">GCC Issue</a>)</li>
1753          <li>Fixed handling NULL return value of {@code setlocale()} in libstdc++/GCC4.7.
1754            (<a href="http://b.android.com/46718">Issue 46718</a>)
1755          <li>Fixed {@code ld.gold} runtime undefined reference to {@code __exidx_start} and
1756            {@code __exidx_start_end}.
1757            (<a href="https://android-review.googlesource.com/#/c/52134">Change 52134</a>)</li>
1758          <li>Fixed Clang 3.1 internal compiler error when using Eigen library.
1759            (<a href="http://b.android.com/41246">Issue 41246</a>)</li>
1760          <li>Fixed Clang 3.1 internal compiler error including {@code &lt;chrono&gt;} in C++11
1761mode.
1762            (<a href="http://b.android.com/39600">Issue 39600</a>)</li>
1763          <li>Fixed Clang 3.1 internal compiler error when generating object code for a method
1764            call to a uniform initialized {@code rvalue}.
1765            (<a href="http://b.android.com/41387">Issue 41387</a>)</li>
1766          <li>Fixed Clang 3.1/X86 stack realignment.
1767            (<a href="https://android-review.googlesource.com/#/c/52154">Change 52154</a>)</li>
1768          <li>Fixed problem with GNU Debugger (GDB) SIGILL when debugging on Android 4.1.2.
1769            (<a href="http://b.android.com/40941">Issue 40941</a>)</li>
1770          <li>Fixed problem where GDB cannot set {@code source:line} breakpoints when symbols
1771contain
1772            long, indirect file paths.
1773            (<a href="http://b.android.com/42448">Issue 42448</a>)</li>
1774          <li>Fixed GDB {@code read_program_header} for MIPS PIE executables.
1775            (<a href="https://android-review.googlesource.com/#/c/49592">Change 49592</a>)</li>
1776          <li>Fixed {@code STLport} segmentation fault in {@code uncaught_exception()}.
1777            (<a href="https://android-review.googlesource.com/#/c/50236">Change 50236</a>)</li>
1778          <li>Fixed {@code STLport} bus error in exception handling due to unaligned access of
1779            {@code DW_EH_PE_udata2}, {@code DW_EH_PE_udata4}, and {@code DW_EH_PE_udata8}.</li>
1780          <li>Fixed Gabi++ infinite recursion problem with {@code nothrow new[]} operator.
1781            (<a href="http://b.android.com/52833">Issue 52833</a>)</li>
1782          <li>Fixed Gabi++ wrong offset to exception handler pointer.
1783            (<a href="https://android-review.googlesource.com/#/c/53446">Change 53446</a>)</li>
1784          <li>Removed Gabi++ redundant free on exception object
1785            (<a href="https://android-review.googlesource.com/#/c/53447">Change 53447</a>)</li>
1786        </ul>
1787      </dd>
1788
1789      <dt>Other bug fixes:</dt>
1790      <dd>
1791        <ul>
1792          <li>Fixed NDK headers:
1793            <ul>
1794              <li>Removed redundant definitions of {@code size_t}, {@code ssize_t}, and
1795                {@code ptrdiff_t}.</li>
1796              <li>Fixed MIPS and ARM {@code fenv.h} header.</li>
1797              <li>Fixed {@code stddef.h} to not redefine {@code offsetof} since it already exists
1798                in the toolchain.</li>
1799              <li>Fixed {@code elf.h} to contain {@code Elf32_auxv_t} and {@code Elf64_auxv_t}.
1800                (<a href="http://b.android.com/38441">Issue 38441</a>)
1801                </li>
1802              <li>Fixed the {@code #ifdef} C++ definitions in the
1803                {@code OpenSLES_AndroidConfiguration.h} header file.
1804                (<a href="http://b.android.com/53163">Issue 53163</a>)
1805                </li>
1806            </ul>
1807          </li>
1808          <li>Fixed {@code STLport} to abort after out of memory error instead of silently exiting.
1809            </li>
1810          <li>Fixed system and Gabi++ headers to be able to compile with API level 8 and lower.</li>
1811          <li>Fixed {@code cpufeatures} to not parse {@code /proc/self/auxv}.
1812            (<a href="http://b.android.com/43055">Issue 43055</a>)</li>
1813          <li>Fixed {@code ld.gold} to not depend on host libstdc++ and on Windows platforms,
1814            to not depend on the {@code libgcc_sjlj_1.dll} library.</li>
1815          <li>Fixed Clang 3.1 which emits inconsistent register list in {@code .vsave} and fails
1816            assembler.
1817            (<a href="https://android-review.googlesource.com/#/c/49930">Change 49930</a>)</li>
1818          <li>Fixed Clang 3.1 to be able to compile libgabi++ and pass the {@code test-stlport}
1819            tests for MIPS build targets.
1820            (<a href="https://android-review.googlesource.com/#/c/51961">Change 51961</a>)</li>
1821          <li>Fixed Clang 3.1 to only enable exception by default for C++, not for C.</li>
1822          <li>Fixed several issues in Clang 3.1 to pass most GNU exception tests.</li>
1823          <li>Fixed scripts {@code clang} and {@code clang++} in standalone NDK compiler to detect
1824            {@code -cc1} and to not specify {@code -target} when found.</li>
1825          <li>Fixed {@code ndk-build} to observe {@code NDK_APP_OUT} set in {@code Application.mk}.
1826            </li>
1827          <li>Fixed X86 {@code libc.so} and {@code lib.a} which were missing the {@code sigsetjmp}
1828            and {@code siglongjmp} functions already declared in {@code setjmp.h}.
1829            (<a href="http://b.android.com/19851">Issue 19851</a>)</li>
1830          <li>Patched GCC 4.4.3/4.6/4.7 libstdc++ to work with Clang in C++ 11.
1831            (<a href="http://clang.llvm.org/cxx_status.html">Clang Issue</a>)</li>
1832          <li>Fixed cygwin path in argument passed to {@code HOST_AWK}.</li>
1833          <li>Fixed {@code ndk-build} script warning in windows when running from project's JNI
1834            directory.
1835            (<a href="http://b.android.com/40192">Issue 40192</a>)</li>
1836          <li>Fixed problem where the {@code ndk-build} script does not build if makefile has
1837            trailing whitespace in the {@code LOCAL_PATH} definition.
1838            (<a href="http://b.android.com/42841">Issue 42841</a>)</li>
1839        </ul>
1840      </dd>
1841
1842      <dt>Other changes:</dt>
1843      <dd>
1844        <ul>
1845          <li>Enabled threading support in GCC/MIPS toolchain.</li>
1846          <li>Updated GCC exception handling helpers {@code __cxa_begin_cleanup} and
1847            {@code __cxa_type_match} to have <em>default</em> visibility from the previous
1848            <em>hidden</em> visibility in GNU libstdc++. For more information, see
1849            {@code CHANGES.HTML}.</li>
1850          <li>Updated build scripts so that Gabi++ and STLport static libraries are now built with
1851            hidden visibility except for exception handling helpers.</li>
1852          <li>Updated build so that {@code STLport} is built for ARM in Thumb mode.</li>
1853          <li>Added support for {@code std::set_new_handler} in Gabi++.
1854            (<a href="http://b.android.com/52805">Issue 52805</a>)</li>
1855          <li>Enabled {@code FUTEX} system call in GNU libstdc++.</li>
1856          <li>Updated {@code ndk-build} so that it  no longer copies prebuilt static library to
1857            a project's {@code obj/local/&lt;abi&gt;/} directory.
1858            (<a href="http://b.android.com/40302">Issue 40302</a>)</li>
1859          <li>Removed {@code __ARM_ARCH_5*__} from ARM {@code toolchains/*/setup.mk} script.
1860            (<a href="http://b.android.com/21132">Issue 21132</a>)</li>
1861          <li>Built additional GNU libstdc++ libraries in thumb for ARM.</li>
1862          <li>Enabled MIPS floating-point {@code madd/msub/nmadd/nmsub/recip/rsqrt}
1863            instructions with 32-bit FPU.</li>
1864          <li>Enabled graphite loop optimizer in GCC 4.6 and 4.7 to allow more optimizations:
1865            {@code -fgraphite}, {@code -fgraphite-identity}, {@code -floop-block}, {@code
1866-floop-flatten},
1867            {@code -floop-interchange}, {@code -floop-strip-mine}, {@code -floop-parallelize-all},
1868            and {@code -ftree-loop-linear}.
1869            (<a href="http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">info</a>)</li>
1870          <li>Enabled {@code polly} for Clang 3.1 on Linux and Max OS X 32-bit hosts which analyzes
1871            and optimizes memory access. (<a href="http://polly.llvm.org">info</a>)</li>
1872          <li>Enabled {@code -flto} in GCC 4.7, 4.6, Clang 3.2 and Clang 3.1 on linux (Clang LTO
1873            via LLVMgold.so). MIPS compiler targets are not supported because {@code ld.gold}
1874            is not available.</li>
1875          <li>Enabled {@code --plugin} and {@code --plugin-opt} for {@code ld.gold} in GCC 4.6/4.7.
1876            </li>
1877          <li>Enabled {@code --text-reorder} for {@code ld.gold} in GCC 4.7.</li>
1878          <li>Configured GNU libstdc++ with {@code _GLIBCXX_USE_C99_MATH} which undefines the
1879            {@code isinf} script in the bionic header. For more information, see
1880            {@code CHANGES.html}.</li>
1881          <li>Added {@code APP_LDFLAGS} to the build scripts. For more information, see
1882            {@code ANDROID-MK.html}.</li>
1883          <li>Updated build scripts to allow {@code NDK_LOG=0} to disable the {@code NDK_LOG}.</li>
1884          <li>Updated build scripts to allow {@code NDK_HOST_32BIT=0} to disable the host developer
1885            environment 32-bit toolchain.</li>
1886          <li>Changed the default GCC/X86 flags {@code -march=} and {@code -mtune=} from
1887            {@code pentiumpro} and {@code generic} to {@code i686} and {@code atom}.</li>
1888          <li>Enhanced toolchain build scripts:
1889            <ul>
1890              <li>Fixed a race condition in {@code build-gcc.sh} for the {@code mingw} build type
1891                which was preventing a significant amount of parallel build processing.</li>
1892              <li>Updated {@code build-gabi++.sh} and {@code build-stlport.sh} so they can now run
1893                from the NDK package.
1894                (<a href="http://b.android.com/52835">Issue 52835</a>)
1895                </li>
1896              <li>Fixed {@code run-tests.sh} in the {@code MSys} utilities collection.</li>
1897              <li>Improved 64-bit host toolchain and Canadian Cross build support.</li>
1898              <li>Updated {@code build-mingw64-toolchain.sh} script to more recent version.</li>
1899              <li>Added option to build {@code libgnustl_static.a} and {@code stlport_static.a}
1900                without hidden visibility.</li>
1901            </ul>
1902          </li>
1903        </ul>
1904
1905      </dd>
1906    </dl>
1907  </div>
1908</div>
1909
1910
1911<div class="toggle-content closed">
1912  <p><a href="#" onclick="return toggleContent(this)">
1913    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
1914      alt="">Android NDK, Revision 8d</a> <em>(December 2012)</em>
1915  </p>
1916
1917  <div class="toggle-content-toggleme">
1918    <dl>
1919      <dt>Important changes:</dt>
1920      <dd>
1921        <ul>
1922          <li>Added the GNU Compiler Collection (GCC) 4.7 compiler to the NDK. The GCC 4.6 compiler
1923            is still the default, so you must to explicitly enable the new version as follows:
1924            <ul>
1925              <li>For {@code ndk-build}, export the {@code NDK_TOOLCHAIN_VERSION=4.7} variable
1926                <em>or</em> add it to {@code Application.mk}.</li>
1927              <li>For standalone builds, add the {@code --toolchain=} option to
1928                {@code make-standalone-toolchain.sh}, for example:
1929                <pre>--toolchain=arm-linux-androideabi-4.7</pre></li>
1930            </ul>
1931            <p class="note">
1932              <strong>Note:</strong> This feature is experimental. Please try it and
1933              <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p>
1934          </li>
1935          <li>Added {@code stlport} exception support via gabi++.  Note that the new gabi++
1936            depends on {@code dlopen} and related code, meaning that:
1937            <ul>
1938              <li>You can no longer build a <em>static</em> executable using the {@code -static}
1939                option or include {@code libstlport_static.a} using
1940                {@code APP_STL := stlport_static}. (You can still use the {@code -static} option
1941                with a standalone toolchain.) Compiling a <em>dynamic</em> executable using
1942                {@code include $(BUILD_EXECUTABLE)} continues to work because the compiler
1943                automatically adds the {@code -ldl} option.</li>
1944              <li>If your project links using {@code -nostdlib} and {-Wl,--no-undefined}, you
1945                must manually include the {@code -ldl} option.</li>
1946            </ul>
1947              For more information, see {@code CPLUSPLUS-SUPPORT.html}.
1948
1949              <p class="note">
1950                <strong>Note:</strong> This feature is experimental and works better with the GCC
1951                4.6/4.7 compilers than with GCC 4.4.3 or Clang 3.1. Please try it and
1952                <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p>
1953          </li>
1954          <li>Added a {@code -mstack-protector-guard=} option for x86 to choose between a
1955            <em>global</em> default path which is compatible with older Android C library (bionic)
1956            and a new <em>tls</em> path (%gs:20) for {@code -fstack-protector},
1957            {@code -fstack-protector-all} and {@code -fstack-protector-strong} using the GCC 4.6
1958            and higher compilers.
1959
1960            <p class="note">
1961              <strong>Note:</strong> The {@code -mstack-protector-guard} setting itself does not
1962              enable any {@code -fstack-protector*} options.</p>
1963          </li>
1964          <li>Added {@code android_setCpu()} function to
1965            {@code sources/android/cpufeatures/cpu-features.c} for use when auto-detection via
1966            {@code /proc} is not possible in Android 4.1 and higher.
1967            (<a href="http://code.google.com/p/chromium/issues/detail?id=164154">Chromium Issue
1968            164154</a>)</li>
1969        </ul>
1970      </dd>
1971
1972      <dt>Important bug fixes:</dt>
1973      <dd>
1974        <ul>
1975          <li>Fixed unnecessary rebuild of object files when using the {@code ndk-build} script.
1976            (<a href="http://b.android.com/39810">Issue 39810</a>)</li>
1977          <li>Fixed a linker failure with the NDK 8c release for Mac OS X 10.6.x that produced the
1978            following error:
1979            <pre>
1980dyld: lazy symbol binding failed: Symbol not found: _memmem
1981Referenced from: ...../arm-linux-androideabi/bin/ld
1982Expected in: /usr/lib/libSystem.B.dylib</pre>
1983            This problem was caused by building on Mac OS X 10.7, which produced binaries that were
1984            not compatible with Mac OS 10.6.x and the NDK.
1985          </li>
1986          <li>Removed the {@code -x c++} options from the Clang++ standalone build script.
1987          (<a href="http://b.android.com/39089">Issue 39089</a>)</li>
1988          <li>Fixed issues using the {@code NDK_TOOLCHAIN_VERSION=clang3.1} option in Cygwin.
1989           (<a href="http://b.android.com/39585">Issue 39585</a>)</li>
1990          <li>Fixed the {@code make-standalone-toolchain.sh} script to allow generation of a
1991            standalone toolchain using the Cygwin or MinGW environments. The resulting toolchain
1992            can be used in Cygwin, MingGW or CMD.exe environments.
1993            (<a href="http://b.android.com/39915">Issue 39915</a>,
1994            <a href="http://b.android.com/39585">Issue 39585</a>)</li>
1995          <li>Added missing {@code SL_IID_ANDROIDBUFFERQUEUESOURCE} option in android-14 builds for
1996            ARM and X86.
1997            (<a href="http://b.android.com/40625">Issue 40625</a>)</li>
1998          <li>Fixed x86 CPU detection for the {@code ANDROID_CPU_X86_FEATURE_MOVBE} feature.
1999            (<a href="http://b.android.com/39317">Issue 39317</a>)</li>
2000          <li>Fixed an issue preventing the Standard Template Library (STL) from using C++
2001            sources that do not have a {@code .cpp} file extension.</li>
2002          <li>Fixed GCC 4.6 ARM internal compiler error <em>at reload1.c:1061</em>.
2003            (<a href="http://b.android.com/20862">Issue 20862</a>)</li>
2004          <li>Fixed GCC 4.4.3 ARM internal compiler error <em>at emit-rtl.c:1954</em>.
2005            (<a href="http://b.android.com/22336">Issue 22336</a>)</li>
2006          <li>Fixed GCC 4.4.3 ARM internal compiler error <em>at postreload.c:396</em>.
2007            (<a href="http://b.android.com/22345">Issue 22345</a>)</li>
2008          <li>Fixed problem with GCC 4.6/4.7 skipping lambda functions.
2009            (<a href="http://b.android.com/35933">Issue 35933</a>)</li>
2010        </ul>
2011      </dd>
2012
2013      <dt>Other bug fixes:</dt>
2014      <dd>
2015        <ul>
2016          <li>NDK header file fixes:
2017            <ul>
2018              <li>Fixed {@code __WINT_TYPE__} and {@code wint_t} to be the same type.</li>
2019              <li>Corrected typo in {@code android/bitmap.h}.
2020                (<a href="http://b.android.com/15134">Issue 15134</a>)
2021              </li>
2022              <li>Corrected typo in {@code errno.h}.</li>
2023              <li>Added check for the presence of {@code __STDC_VERSION__} in {@code sys/cdefs.h}.
2024                (<a href="http://b.android.com/14627">Issue 14627</a>)
2025              </li>
2026              <li>Reorganized headers in {@code byteswap.h} and {@code dirent.h}.</li>
2027              <li>Fixed {@code limits.h} to include {@code page.h} which provides {@code PAGE_SIZE}
2028                settings.
2029                (<a href="http://b.android.com/39983">Issue 39983</a>)
2030              </li>
2031              <li>Fixed return type of {@code glGetAttribLocation()} and
2032                {@code glGetUniformLocation()} from {@code int} to {@code GLint}.</li>
2033              <li>Fixed {@code __BYTE_ORDER} constant for x86 builds.
2034                (<a href="http://b.android.com/39824">Issue 39824</a>)
2035              </li>
2036            </ul>
2037          </li>
2038          <li>Fixed {@code ndk-build} script to not overwrite {@code -Os} with {@code -O2} for ARM
2039            builds.</li>
2040          <li>Fixed build scripts to allow overwriting of {@code HOST_AWK}, {@code HOST_SED}, and
2041            {@code HOST_MAKE} settings.</li>
2042          <li>Fixed issue for {@code ld.gold} on {@code fsck_msdos} builds linking objects built by
2043            the Intel C/C++ compiler (ICC).</li>
2044          <li>Fixed ARM EHABI support in Clang to conform to specifications.</li>
2045          <li>Fixed GNU Debugger (GDB) to shorten the time spent on walking the target's link map
2046            during {@code solib} events.
2047            (<a href="http://b.android.com/38402">Issue 38402</a>)</li>
2048          <li>Fixed missing {@code libgcc.a} file when linking shared libraries.</li>
2049        </ul>
2050      </dd>
2051
2052      <dt>Other changes:</dt>
2053      <dd>
2054        <ul>
2055          <li>Backported 64-bit built-in atomic functions for ARM to GCC 4.6.</li>
2056          <li>Added documentation for audio output latency, along with other documentation and
2057            fixes.</li>
2058          <li>Fixed debug builds with Clang so that non-void functions now raise a {@code SIGILL}
2059            signal for paths without a return statement.</li>
2060          <li>Updated {@code make-standalone-toolchain.sh} to accept the suffix {@code -clang3.1}
2061            which is equivalent to adding {@code --llvm-version=3.1} to the GCC 4.6 toolchain.</li>
2062          <li>Updated GCC and Clang bug report URL to:
2063            <a
2064href="http://source.android.com/source/report-bugs.html">http://source.android.com/source/report-bug
2065s.html</a></li>
2066          <li>Added ARM ELF support to {@code llvm-objdump}.</li>
2067          <li>Suppressed <em>treating c input as c++</em> warning for Clang builds.</li>
2068          <li>Updated build so that only the 32-bit version of {@code libiberty.a} is built and
2069            placed in {@code lib32/}.</li>
2070        </ul>
2071      </dd>
2072    </dl>
2073  </div>
2074</div>
2075
2076
2077<div class="toggle-content closed">
2078  <p><a href="#" onclick="return toggleContent(this)">
2079    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
2080      alt="">Android NDK, Revision 8c</a> <em>(November 2012)</em>
2081  </p>
2082
2083  <div class="toggle-content-toggleme">
2084    <dl>
2085      <dt>Important changes:</dt>
2086
2087      <dd>
2088        <ul>
2089          <li>Added the Clang 3.1 compiler to the NDK. The GNU Compiler Collection (GCC) 4.6 is
2090          still the default, so you must explicitly enable the Clang compiler option as follows:
2091            <ul>
2092              <li>For {@code ndk-build}, export {@code NDK_TOOLCHAIN_VERSION=clang3.1} <em>or</em>
2093                add this environment variable setting to {@code Application.mk}.</li>
2094              <li>For standalone builds, add {@code --llvm-version=3.1} to
2095                {@code make-standalone-toolchain.sh} and replace {@code CC} and {@code CXX} in your
2096                makefile with {@code &lt;tool-path&gt;/bin/clang} and
2097                {@code &lt;tool-path&gt;/bin/clang++}. See {@code STANDALONE-TOOLCHAIN.html} for
2098                details.</li>
2099            </ul>
2100            <p class="note"><strong>Note:</strong> This feature is experimental. Please try it and
2101            <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p></li>
2102          <li>Added Gold linker {@code ld.gold} for the Windows toolchain. Gold linker is also the
2103            default for ARM and X86 on all hosts. You may override it to use the {@code ld.bfd}
2104            linker by adding {@code LOCAL_LDFLAGS += -fuse-ld=bfd} to {@code Android.mk}, or by
2105passing
2106            {@code -fuse-ld=bfd} to the g++/clang++ command line that does the linking.</li>
2107          <li>Added checks for spaces in the NDK path to the {@code ndk-build[.cmd]} and
2108            {@code ndk-gdb} scripts, to prevent build errors that are difficult to diagnose.</li>
2109          <li>Made the following changes to API level handling:
2110            <ul>
2111              <li>Modified build logic so that projects that specify {@code android-10} through
2112                {@code android-13} in {@code APP_PLATFORM}, {@code project.properties} or
2113                {@code default.properties} link against {@code android-9} instead of
2114                {@code android-14}.
2115              <li>Updated build so that executables using android-16 (Jelly Bean) or higher are
2116                compiled with the {@code -fPIE} option for position-independent executables (PIE).
2117                A new {@code APP_PIE} option allows you to control this behavior. See {@code
2118                APPLICATION-MK.html} for details.
2119                <p class="note">
2120                  <strong>Note:</strong> All API levels above 14 still link against {@code
2121                  platforms/android-14} and no new {@code platforms/android-N} have been added.
2122                </p></li>
2123              <li>Modified {@code ndk-build} to provide warnings if the adjusted API level is larger
2124              than {@code android:minSdkVersion} in the project's {@code AndroidManifest.xml}.</li>
2125            </ul>
2126          </li>
2127          <li>Updated the {@code cpu-features} helper library to include more ARM-specific features.
2128          See {@code sources/android/cpufeatures/cpu-features.h} for details.</li>
2129          <li>Modified the long double on the X86 platform to be 8 bytes. This data type is now the
2130          same size as a double, but is still treated as a distinct type.</li>
2131          <li>Updated build for {@code APP_ABI=armeabi-v7a}:
2132            <ul>
2133              <li>Modified this build type to pass the {@code -march=armv7-a} parameter
2134              to the linker. This change ensures that v7-specific libraries and {@code crt*.o} are
2135              linked correctly.</li>
2136              <li>Added {@code -mfpu=vfpv3-d16} to {@code ndk-build} instead of the
2137              {@code -mfpu=vfp} option used in previous releases.</li>
2138            </ul>
2139          </li>
2140        </ul>
2141      </dd>
2142    </dl>
2143
2144    <dl>
2145      <dt>Important bug fixes:</dt>
2146
2147      <dd>
2148        <ul>
2149          <li>Fixed an issue where running {@code make-standalone-toolchain.sh} with root privileges
2150            resulted in the stand alone tool chain being inaccessible to some users.
2151            (<a href="http://b.android.com/35279">Issue 35279</a>)
2152            <ul>
2153              <li>All files and executables in the NDK release package are set to have read and
2154                execute permissions for all.</li>
2155              <li>The ownership/group of {@code libstdc++.a} is now preserved when copied.</li>
2156            </ul>
2157          </li>
2158          <li>Removed redundant {@code \r} from Windows prebuilt {@code echo.exe}. The redundant
2159          {@code \r} caused {@code gdb.setup} to fail in the GNU Debugger (GDB) because it
2160          incorrectly became part of the path.
2161          (<a href="http://b.android.com/36054">Issue 36054</a>)</li>
2162          <li>Fixed Windows parallel builds that sometimes failed due to timing issues in the
2163          {@code host-mkdir} implementation.
2164          (<a href="http://b.android.com/25875">Issue 25875</a>)</li>
2165          <li>Fixed GCC 4.4.3 GNU {@code libstdc++} to <em>not</em> merge {@code typeinfo} names by
2166          default. For more details, see
2167          {@code toolchain repo gcc/gcc-4.4.3/libstdc++-v3/libsupc++/typeinfo}.
2168          (<a href="http://b.android.com/22165">Issue 22165</a>)</li>
2169          <li>Fixed problem on {@code null} context in GCC 4.6
2170          {@code cp/mangle.c::write_unscoped_name}, where GCC may crash when the context is
2171          {@code null} and dereferenced in {@code TREE_CODE}.</li>
2172          <li>Fixed GCC 4.4.3 crashes on ARM NEON-specific type definitions for floats.
2173          (<a href="http://b.android.com/34613">Issue 34613</a>)</li>
2174          <li>Fixed the {@code STLport} internal {@code _IteWrapper::operator*()} implementation
2175          where a stale stack location holding the dereferenced value was returned and caused
2176          runtime crashes.
2177          (<a href="http://b.android.com/38630">Issue 38630</a>)</li>
2178
2179          <li>ARM-specific fixes:
2180            <ul>
2181              <li>Fixed ARM GCC 4.4.3/4.6 {@code g++} to not warn that the <em>mangling of
2182              &lt;va_list&gt; was changed in GCC 4.4</em>. The workaround using the
2183              {@code -Wno-psabi} switch to avoid this warning is no longer required.</li>
2184              <li>Fixed an issue when a project with {@code .arm} or {@code .neon} suffixes in
2185              {@code LOCAL_SRC_FILES} also used {@code APP_STL}. With {@code APP_STL}, the
2186              {@code ndk-build} script searches for C++ files in {@code LOCAL_SRC_FILES} before
2187              adding STL {@code header/lib} paths to compilation. Modified {@code ndk-build} to
2188              filter out {@code .arm} and {@code .neon} suffixes before the search, otherwise items
2189              in {@code LOCAL_SRC_FILES} like {@code myfile.cpp.arm.neon} won't be compiled as C++
2190              code.</li>
2191              <li>Fixed {@code binutils-2.21/ld.bfd} to be capable of linking object from older
2192              binutils without {@code tag_FP_arch}, which was producing <em>assertion fail</em>
2193              error messages in GNU Binutils.
2194              (<a href="http://b.android.com/35209">Issue 35209</a>)
2195              </li>
2196              <li>Removed <em>Unknown EABI object attribute 44</em> warning when
2197              {@code binutils-2.19/ld} links prebuilt object by newer {@code binutils-2.21}</li>
2198              <li>Fixed an issue in GNU {@code stdc++} compilation with both {@code -mthumb} and
2199              {@code -march=armv7-a}, by modifying {@code make-standalone-toolchain.sh} to populate
2200              {@code headers/libs} in sub-directory {@code armv7-a/thumb}.
2201              (<a href="http://b.android.com/35616">Issue 35616</a>)
2202              </li>
2203              <li>Fixed <em>unresolvable R_ARM_THM_CALL relocation</em> error.
2204              (<a href="http://b.android.com/35342">Issue 35342</a>)
2205              </li>
2206              <li>Fixed internal compiler error at {@code reload1.c:3633}, caused by the ARM
2207              back-end expecting the wrong operand type when sign-extend from {@code char}.
2208              (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50099">GCC Issue 50099</a>)</li>
2209              <li>Fixed internal compiler error with negative shift amount.
2210              (<a href="http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00594.html">GCC Issue</a>)</li>
2211            </ul>
2212          </li>
2213
2214          <li>Fixed {@code -fstack-protector} for X86, which is also the default for the
2215          {@code ndk-build} x86 ABI target.</li>
2216
2217          <li>MIPS-specific fixes:
2218            <ul>
2219              <li>Fixed {@code STLport} endian-ness by setting {@code _STLP_LITTLE_ENDIAN} to 1 when
2220              compiling MIPS {@code libstlport_*}.</li>
2221              <li>Fixed GCC {@code __builtin_unreachable} issue when compiling LLVM.
2222              (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54369">GCC Issue 54369</a>)</li>
2223              <li>Backported fix for {@code cc1} compile process consuming 100% CPU.
2224              (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50380">GCC Issue 50380</a>)</li>
2225            </ul>
2226          </li>
2227
2228          <li>GNU Debugger-specific fixes:
2229            <ul>
2230              <li>Disabled Python support in gdb-7.x at build, otherwise the gdb-7.x configure
2231              function may pick up whatever Python version is available on the host and build
2232              {@code gdb} with a hard-wired dependency on a specific version of Python.
2233              (<a href="http://b.android.com/36120">Issue 36120</a>)
2234              </li>
2235              <li>Fixed {@code ndk-gdb} when {@code APP_ABI} contains {@code all} and matchs none
2236              of the known architectures.
2237              (<a href="http://b.android.com/35392">Issue 35392</a>)
2238              </li>
2239              <li>Fixed Windows pathname support, by keeping the {@code :} character if it looks
2240              like it could be part of a Windows path starting with a drive letter.
2241              (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12843">GDB Issue 12843</a>)
2242              </li>
2243              <li>Fixed adding of hardware breakpoint support for ARM in {@code gdbserver}.
2244              (<a href="http://sourceware.org/ml/gdb-patches/2011-09/msg00200.html">GDB Issue</a>)
2245              </li>
2246              <li>Added fix to only read the current {@code solibs} when the linker is consistent.
2247              This change speeds up {@code solib} event handling.
2248              (<a href="http://b.android.com/37677">Issue 37677</a>)
2249              </li>
2250              <li>Added fix to make repeated attempts to find {@code solib} breakpoints. GDB now
2251              retries {@code enable_break()} during every call to {@code svr4_current_sos()} until
2252              it succeeds.
2253              (<a href="https://android-review.googlesource.com/#/c/43563">Change 43563</a>)</li>
2254              <li>Fixed an issue where {@code gdb} would not stop on breakpoints placed in
2255              {@code dlopen-ed} libraries.
2256              (<a href="http://b.android.com/34856">Issue 34856</a>)
2257              </li>
2258              <li>Fixed {@code SIGILL} in dynamic linker when calling {@code dlopen()}, on system
2259              where {@code /system/bin/linker} is stripped of symbols and
2260              {@code rtld_db_dlactivity()} is implemented as {@code Thumb}, due to not preserving
2261              {@code LSB} of {@code sym_addr}.
2262              (<a href="http://b.android.com/37147">Issue 37147</a>)
2263              </li>
2264            </ul>
2265          </li>
2266        </ul>
2267      </dd>
2268    </dl>
2269
2270    <dl>
2271      <dt>Other bug fixes:</dt>
2272
2273      <dd>
2274        <ul>
2275          <li>Fixed NDK headers:
2276            <ul>
2277              <li>Fixed {@code arch-mips/include/asm/*} code that was incorrectly removed from
2278              original kernel. (<a href="https://android-review.googlesource.com/#/c/43335">Change
2279              43335</a>)</li>
2280              <li>Replaced struct member data {@code __unused} with {@code __linux_unused} in
2281              {@code linux/sysctl.h} and {@code linux/icmp.h} to avoid conflict with
2282              {@code #define __unused} in {@code sys/cdefs.h}.</li>
2283              <li>Fixed {@code fenv.h} for enclosed C functions with {@code __BEGIN_DECLS} and
2284              {@code __END_DECLS}.</li>
2285              <li>Removed unimplemented functions in {@code malloc.h}.</li>
2286              <li>Fixed {@code stdint.h} defintion of {@code uint64_t} for ANSI compilers.
2287              (<a href="http://b.android.com/1952">Issue 1952</a>)</li>
2288              <li>Fixed preprocessor macros in {@code &lt;arch&gt;/include/machine/*}.</li>
2289              <li>Replaced {@code link.h} for MIPS with new version supporting all platforms.</li>
2290              <li>Removed {@code linux-unistd.h}</li>
2291              <li>Move GLibc-specific macros {@code LONG_LONG_MIN}, {@code LONG_LONG_MAX} and
2292              {@code ULONG_LONG_MAX} from {@code &lt;pthread.h&gt;} to {@code
2293&lt;limits.h&gt;}.</li>
2294            </ul>
2295          </li>
2296          <li>Fixed a buffer overflow in {@code ndk-stack-parser}.</li>
2297          <li>Fixed {@code _STLP_USE_EXCEPTIONS}, when not defined, to omit all declarations
2298          and uses of {@code __Named_exception}. Compiling and use of {@code __Named_exception}
2299          settings only occurs when {@code STLport} is allowed to use exceptions.</li>
2300          <li>Fixed building of Linux-only NDK packages without also building Windows code. Use the
2301          following settings to perform this type of build:
2302          <pre>./build/tools/make-release.sh --force --systems=linux-x86</pre></li>
2303          <li>Fixed {@code libc.so} so it does not export {@code atexit()} and {@code __do_handler}.
2304          These symbols are exported for ARM builds by the system version of the C library to
2305          support legacy native libraries. NDK-generated should never reference them directly.
2306          Instead, each shared library or executable should embed its own version of these symbols,
2307          provided by {@code crtbegin_*.o}.
2308          <p>If your project is linked with the {@code -nostdlib -Wl,--no-undefined} options, you
2309          must provide your own {@code __dso_handle} because {@code crtbegin_so.o} is not linked in
2310          this case. The content of {@code __dso_handle} does not matter, as shown in the following
2311          example code:</p>
2312<pre>
2313extern "C" {
2314  extern void *__dso_handle __attribute__((__visibility__ ("hidden")));
2315  void *__dso_handle;
2316}
2317</pre>
2318          </li>
2319          <li>Fixed symbol decoder for ARM used in {@code objdump} for {@code plt} entries to
2320          generate a more readable form {@code function@plt}.</li>
2321          <li>Removed the following symbols, introduced in GCC 4.6 {@code libgcc.a}, from
2322          the X86 platform {@code libc.so} library: {@code __aeabi_idiv0}, {@code __aeabi_ldiv0},
2323          {@code __aeabi_unwind_cpp_pr1}, and {@code __aeabi_unwind_cpp_pr2}.</li>
2324          <li>Removed unused {@code .ctors}, {@code .dtors}, and {@code .eh_frame} in MIPS
2325          {@code crt*_so.S}.</li>
2326          <li>Updated {@code ndk-gdb} so that it only takes the last line of output for
2327          {@code ndk-build} {@code DUMP_XXXX}. This change ensures that if {@code Application.mk} or
2328          {@code Android.mk} print something with {@code $(info ...)} syntax, it does not get
2329          injected into the result of {@code DUMP_XXXX}.
2330          (<a href="https://groups.google.com/d/msg/android-ndk/-/ew0lTWGr1UEJ">More info</a>)</li>
2331        </ul>
2332      </dd>
2333    </dl>
2334
2335    <dl>
2336      <dt>Other changes:</dt>
2337
2338      <dd>
2339        <ul>
2340          <li>Removed {@code arch-x86} and {@code arch-mips} headers from
2341          {@code platforms/android-[3,4,5,8]}. Those headers were incomplete, since both X86 and
2342          MIPS ABIs are only supported at API 9 or higher.</li>
2343          <li>Simplified c++ include path in standalone packages, as shown below.
2344          (<a href="http://b.android.com/35279">Issue 35279</a>)
2345<pre>
2346&lt;path&gt;/arm-linux-androideabi/include/c++/4.6.x-google
2347  to:
2348&lt;path&gt;/include/c++/4.6/
2349</pre></li>
2350          <li>Fixed {@code ndk-build} to recognize more C++ file extensions by default:
2351          {@code .cc .cp .cxx .cpp .CPP .c++ .C}. You may still use {@code LOCAL_CPP_EXTENSION} to
2352          overwrite these extension settings.</li>
2353          <li>Fixed an issue in {@code samples/san-angeles} that caused a black screen or freeze
2354          frame on re-launch.</li>
2355          <li>Replaced deprecated APIs in NDK samples.
2356          (<a href="http://b.android.com/20017">Issue 20017</a>)
2357            <ul>
2358              <li>{@code hello-gl2} from android-5 to android-7</li>
2359              <li>{@code native-activity} from android-9 to android-10</li>
2360              <li>{@code native-audio} from android-9 to android-10</li>
2361              <li>{@code native-plasma} from android-9 to android-10</li>
2362            </ul>
2363          </li>
2364          <li>Added new branding for Android executables with a simpler scheme in section
2365          {@code .note.android.ident} (defined in {@code crtbegin_static/dynamic.o}) so that
2366          debugging tools can act accordingly. The structure member and values are defined as
2367          follows:
2368<pre>
2369static const struct {
2370  int32_t namesz;  /* = 8,  sizeof ("Android") */
2371  int32_t descsz;  /* = 1 * sizeof(int32_t) */
2372  int32_t type;    /* = 1, ABI_NOTETYPE */
2373  char name[sizeof "Android"];  /* = "Android" */
2374  int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */
2375}
2376</pre>
2377            <p>The previous branding options in section {@code .note.ABI-tag} are deprecated.</p>
2378          </li>
2379          <li>Added a new script {@code run-tests-all.sh} which calls {@code run-tests.sh} and
2380          {@code standalone/run.sh} with various conditions. The script {@code run-tests.sh} runs
2381          without the {@code --abi} option, and is enhanced to compile most of the tests for all
2382          supported ABIs and run on all attached devices</li>
2383        </ul>
2384      </dd>
2385    </dl>
2386
2387  </div>
2388</div>
2389
2390<div class="toggle-content closed">
2391  <p><a href="#" onclick="return toggleContent(this)">
2392    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
2393      alt="">Android NDK, Revision 8b</a> <em>(July 2012)</em>
2394  </p>
2395
2396  <div class="toggle-content-toggleme">
2397    <p>The main features of this release are a new GNU Compiler Collection (GCC) 4.6 toolchain and
2398GNU Debugger (GDB) 7.3.x which adds debugging support for the Android 4.1 (API Level 16) system
2399image.</p>
2400
2401    <dl>
2402      <dt>Important bug fixes:</dt>
2403
2404      <dd>
2405        <ul>
2406          <li>Fixed {@code LOCAL_SHORT_COMMANDS} issues on Mac OS, Windows Cygwin environments for
2407static libraries. List file generation is faster, and it is not regenerated to avoid repeated
2408project rebuilds.</li>
2409          <li>Fixed several issues in {@code ndk-gdb}:
2410            <ul>
2411              <li>Updated tool to pass flags {@code -e}, {@code -d} and {@code -s} to adb more
2412consistently.</li>
2413              <li>Updated tool to accept device serial names containing spaces.</li>
2414              <li>Updated tool to retrieve {@code /system/bin/link} information, so {@code gdb} on
2415the host can set a breakpoint in {@code __dl_rtld_db_dlactivity} and be aware of linker activity
2416(e.g., rescan {@code solib} symbols when {@code dlopen()} is called).</li>
2417            </ul>
2418          </li>
2419          <li>Fixed {@code ndk-build clean} on Windows, which was failing to remove
2420{@code ./libs/*/lib*.so}.</li>
2421          <li>Fixed {@code ndk-build.cmd} to return a non-zero {@code ERRORLEVEL} when {@code make}
2422fails.</li>
2423          <li>Fixed {@code libc.so} to stop incorrectly exporting the {@code __exidx_start} and
2424{@code __exidx_end} symbols.</li>
2425          <li>Fixed {@code SEGV} when unwinding the stack past {@code __libc_init} for ARM and
2426MIPS.</li>
2427        </ul>
2428      </dd>
2429    </dl>
2430
2431    <dl>
2432      <dt>Important changes:</dt>
2433
2434      <dd>
2435        <ul>
2436          <li>Added GCC 4.6 toolchain ({@code binutils} 2.21 with {@code gold} and GDB 7.3.x) to
2437co-exist with the original GCC 4.4.3 toolchain ({@code binutils} 2.19 and GDB 6.6).
2438            <ul>
2439              <li>GCC 4.6 is now the default toolchain. You may set {@code
2440NDK_TOOLCHAIN_VERSION=4.4.3} in {@code Application.mk} to select the original one.</li>
2441              <li>Support for the {@code gold} linker is only available for ARM and x86
2442architectures on Linux and Mac OS hosts. This support is disabled by default. Add {@code
2443LOCAL_LDLIBS += -fuse-ld=gold} in {@code Android.mk} to enable it.</li>
2444              <li>Programs compiled with {@code -fPIE} require the new {@code GDB} for debugging,
2445including binaries in Android 4.1 (API Level 16) system images.</li>
2446              <li>The {@code binutils} 2.21 {@code ld} tool contains back-ported fixes from
2447version 2.22:
2448                <ul>
2449                  <li>Fixed {@code ld --gc-sections}, which incorrectly retains zombie references to
2450external libraries. (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=13177">more
2451info</a>).</li>
2452                  <li>Fixed ARM {@code strip} command to preserve the original {@code p_align} and
2453{@code p_flags} in {@code GNU_RELRO} section if they are valid. Without this fix, programs
2454built with {@code -fPIE} could not be debugged. (<a
2455href="http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.552&r2=1.553">mor
2456e info</a>)</li>
2457                </ul>
2458              </li>
2459              <li>Disabled {@code sincos()} optimization for compatibility with older
2460                platforms.</li>
2461            </ul>
2462          </li>
2463
2464          <li>Updated build options to enable the Never eXecute (NX) bit and {@code relro}/{@code
2465bind_now} protections by default:
2466            <ul>
2467              <li>Added {@code --noexecstack} to assembler and {@code -z noexecstack} to linker
2468that provides NX protection against buffer overflow attacks by enabling NX bit on stack and
2469heap.</li>
2470              <li>Added {@code -z relro} and  {@code -z now} to linker for hardening of internal
2471data sections after linking to guard against security vulnerabilities caused by memory corruption.
2472(more info: <a href="http://www.akkadia.org/drepper/nonselsec.pdf">1</a>,
2473<a href="http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html">2</a>)</li>
2474
2475              <li>These features can be disabled using the following options:
2476                <ol>
2477                  <li>Disable NX protection by setting the {@code --execstack} option for the
2478assembler and {@code -z execstack} for the linker.</li>
2479                  <li>Disable hardening of internal data by setting the {@code -z norelro} and
2480{@code -z lazy} options for the linker.</li>
2481                  <li>Disable these protections in the NDK {@code jni/Android.mk} by setting the
2482following options:
2483<pre>
2484LOCAL_DISABLE_NO_EXECUTE=true  # disable "--noexecstack" and "-z noexecstack"
2485DISABLE_RELRO=true             # disable "-z relro" and "-z now"
2486</pre>
2487                  </li>
2488                </ol>
2489                <p>See {@code docs/ANDROID-MK.html} for more details.</p>
2490              </li>
2491            </ul>
2492          </li>
2493
2494          <li>Added branding for Android executables with the {@code .note.ABI-tag} section (in
2495{@code crtbegin_static/dynamic.o}) so that debugging tools can act accordingly. The structure
2496member and values are defined as follows:
2497<pre>
2498static const struct {
2499  int32_t namesz;  /* = 4,  sizeof ("GNU") */
2500  int32_t descsz;  /* = 6 * sizeof(int32_t) */
2501  int32_t type;    /* = 1 */
2502  char  name[sizeof "GNU"];  /* = "GNU" */
2503  int32_t os;      /* = 0 */
2504  int32_t major;   /* = 2 */
2505  int32_t minor;   /* = 6 */
2506  int32_t teeny;   /* = 15 */
2507  int32_t os_variant;  /* = 1 */
2508  int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */
2509}</pre>
2510          </li>
2511        </ul>
2512      </dd>
2513    </dl>
2514
2515    <dl>
2516      <dt>Other bug fixes:</dt>
2517
2518      <dd>
2519        <ul>
2520          <li>Fixed {@code mips-linux-gnu} relocation truncated to fit {@code R_MIPS_TLS_LDM} issue.
2521            (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12637">more info</a>)</li>
2522          <li>Fixed {@code ld} tool segfaults when using {@code --gc-sections}.
2523            (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12845">more info</a>)
2524          </li>
2525          <li>Fixed MIPS {@code GOT_PAGE} counting issue.
2526            (<a href="http://sourceware.org/ml/binutils/2011-05/msg00198.html">more info</a>)</li>
2527          <li>Fixed follow warning symbol link for {@code mips_elf_count_got_symbols}.</li>
2528          <li>Fixed follow warning symbol link for {@code mips_elf_allocate_lazy_stub}.</li>
2529          <li>Moved MIPS {@code .dynamic} to the data segment, so that it is writable.</li>
2530          <li>Replaced hard-coded values for symbols with correct segment sizes for MIPS.</li>
2531          <li>Removed the {@code -mno-shared} option from the defaults in the MIPS toolchain.
2532The default for Android toolchain is {@code -fPIC} (or {@code -fpic} if supported). If you do not
2533explicitly specify {@code -mshared}, {@code -fpic}, {@code -fPIC}, {@code -fpie}, or {@code -fPIE},
2534the MIPS compiler adds {@code -mno-shared} that turns off PIC. Fixed compiler not to add
2535{@code -mno-shared} in this case.</li>
2536          <li>Fixed wrong package names in samples {@code hello-jni} and {@code two-libs} so that
2537the {@code tests} project underneath it can compile.</li>
2538        </ul>
2539      </dd>
2540    </dl>
2541
2542    <dl>
2543      <dt>Other Changes:</dt>
2544
2545      <dd>
2546        <ul>
2547          <li>Changed locations of binaries:
2548            <ul>
2549              <li>Moved {@code gdbserver} from
2550{@code toolchain/&lt;arch-os-ver&gt;/prebuilt/gdbserver} to
2551{@code prebuilt/android-&lt;arch&gt;/gdbserver/gdbserver}.</li>
2552              <li>Renamed x86 toolchain prefix from {@code i686-android-linux-} to
2553{@code i686-linux-android-}.</li>
2554              <li>Moved {@code sources/cxx-stl/gnu-libstdc++/include} and {@code lib} to
2555{@code sources/cxx-stl/gnu-libstdc++/4.6} when compiled with GCC 4.6, or
2556{@code sources/cxx-stl/gnu-libstdc++/4.4.3} when compiled with GCC 4.4.3.</li>
2557              <li>Moved {@code libbfd.a} and {@code libintl.a} from {@code lib/} to {@code
2558lib32/}.</li>
2559            </ul>
2560          </li>
2561
2562          <li>Added and improved various scripts in the rebuild and test NDK toolchain:
2563            <ul>
2564              <li>Added {@code build-mingw64-toolchain.sh} to generate a new Linux-hosted toolchain
2565that generates Win32 and Win64 executables.</li>
2566              <li>Improved speed of {@code download-toolchain-sources.sh} by using the {@code
2567clone} command and only using {@code checkout} for the directories that are needed to build the NDK
2568toolchain binaries.</li>
2569              <li>Added {@code build-host-gcc.sh} and {@code build-host-gdb.sh} scripts.</li>
2570              <li>Added {@code tests/check-release.sh} to check the content of a given NDK
2571installation directory, or an existing NDK package.</li>
2572              <li>Rewrote the {@code tests/standalone/run.sh} standalone tests .</li>
2573            </ul>
2574          </li>
2575          <li>Removed {@code if_dl.h} header from all platforms and architectures. The {@code
2576AF_LINK} and {@code sockaddr_dl} elements it describes are specific to BSD (i.e., they don't exist
2577in Linux).</li>
2578        </ul>
2579      </dd>
2580    </dl>
2581
2582  </div>
2583</div>
2584
2585<div class="toggle-content closed">
2586  <p><a href="#" onclick="return toggleContent(this)">
2587    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
2588      alt="">Android NDK, Revision 8</a> <em>(May 2012)</em>
2589  </p>
2590
2591  <div class="toggle-content-toggleme">
2592    <p>This release of the NDK includes support for MIPS ABI and a few additional fixes.</p>
2593
2594    <dl>
2595      <dt>New features:</dt>
2596
2597      <dd>
2598        <ul>
2599          <li>Added support for the MIPS ABI, which allows you to generate machine code that runs on
2600            compatible MIPS-based Android devices. Major features for MIPS include MIPS-specific
2601            toolchains, system headers, libraries and debugging support. For more details regarding
2602            MIPS support, see {@code docs/CPU-MIPS.html} in the NDK package.
2603
2604              <p>By default, code is generated for ARM-based devices. You can add {@code mips} to
2605              your {@code APP_ABI} definition in your {@code Application.mk} file to build
2606              for MIPS platforms. For example, the following line instructs {@code ndk-build}
2607              to build your code for three distinct ABIs:</p>
2608
2609              <pre>APP_ABI := armeabi armeabi-v7a <strong>mips</strong></pre>
2610
2611              <p>Unless you rely on architecture-specific assembly sources, such as ARM assembly
2612              code, you should not need to touch your {@code Android.mk} files to build MIPS
2613              machine code.</p>
2614          </li>
2615
2616          <li>You can build a standalone MIPS toolchain using the {@code --arch=mips}
2617          option when calling <code>make-standalone-toolchain.sh</code>. See
2618          {@code docs/STANDALONE-TOOLCHAIN.html} for more details.
2619          </li>
2620        </ul>
2621
2622        <p class="note"><strong>Note:</strong> To ensure that your applications are available
2623to users only if their devices are capable of running them, Google Play filters applications based
2624on the instruction set information included in your application ? no action is needed on your part
2625to enable the filtering. Additionally, the Android system itself also checks your application at
2626install time and allows the installation to continue only if the application provides a library that
2627is compiled for the device's CPU architecture.</p>
2628      </dd>
2629
2630      <dt>Important bug fixes:</dt>
2631
2632      <dd>
2633        <ul>
2634          <li>Fixed a typo in GAbi++ implementation where the result of {@code
2635          dynamic_cast&lt;D&gt;(b)} of base class object {@code b} to derived class {@code D} is
2636          incorrectly adjusted in the opposite direction from the base class.
2637          (<a href="http://b.android.com/28721">Issue 28721</a>)
2638          </li>
2639          <li>Fixed an issue in which {@code make-standalone-toolchain.sh} fails to copy
2640          {@code libsupc++.*}.</li>
2641        </ul>
2642      </dd>
2643
2644      <dt>Other bug fixes:</dt>
2645
2646      <dd>
2647        <ul>
2648          <li>Fixed {@code ndk-build.cmd} to ensure that {@code ndk-build.cmd} works correctly even
2649          if the user has redefined the {@code SHELL} environment variable, which may be changed
2650          when installing a variety of development tools in Windows environments.
2651          </li>
2652        </ul>
2653      </dd>
2654    </dl>
2655  </div>
2656</div>
2657
2658<div class="toggle-content closed">
2659  <p><a href="#" onclick="return toggleContent(this)">
2660    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
2661      alt="">Android NDK, Revision 7c</a> <em>(April 2012)</em>
2662  </p>
2663
2664  <div class="toggle-content-toggleme">
2665    <p>This release of the NDK includes an important fix for Tegra2-based devices, and a few
2666additional fixes and improvements:</p>
2667
2668    <dl>
2669      <dt>Important bug fixes:</dt>
2670
2671      <dd>
2672        <ul>
2673          <li>Fixed GNU STL armeabi-v7a binaries to not crash on non-NEON
2674  devices. The files provided with NDK r7b were not configured properly,
2675  resulting in crashes on Tegra2-based devices and others when trying to use
2676  certain floating-point functions (e.g., {@code cosf}, {@code sinf}, {@code expf}).</li>
2677        </ul>
2678      </dd>
2679
2680      <dt>Important changes:</dt>
2681
2682      <dd>
2683        <ul>
2684          <li>Added support for custom output directories through the {@code NDK_OUT}
2685  environment variable. When defined, this variable is used to store all
2686  intermediate generated files, instead of {@code $PROJECT_PATH/obj}. The variable is
2687  also recognized by {@code ndk-gdb}. </li>
2688          <li>Added support for building modules with hundreds or even thousands of source
2689  files by defining {@code LOCAL_SHORT_COMMANDS} to {@code true} in your {@code Android.mk}.
2690            <p>This change forces the NDK build system to put most linker or archiver options
2691  into list files, as a work-around for command-line length limitations.
2692  See {@code docs/ANDROID-MK.html} for details.</p>
2693          </li>
2694        </ul>
2695      </dd>
2696
2697      <dt>Other bug fixes:</dt>
2698
2699      <dd>
2700        <ul>
2701          <li>Fixed {@code android_getCpuCount()} implementation in the {@code cpufeatures}
2702helper library. On certain devices, where cores are enabled dynamically by the system, the previous
2703implementation would report the total number of <em>active</em> cores the first time the function
2704was called, rather than the total number of <em>physically available</em> cores.</li>
2705        </ul>
2706      </dd>
2707    </dl>
2708  </div>
2709</div>
2710
2711
2712<div class="toggle-content closed">
2713  <p><a href="#" onclick="return toggleContent(this)">
2714    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
2715      alt="">Android NDK, Revision 7b</a> <em>(February 2012)</em>
2716  </p>
2717
2718  <div class="toggle-content-toggleme">
2719    <p>This release of the NDK includes fixes for native Windows builds, Cygwin and many other
2720      improvements:</p>
2721
2722    <dl>
2723      <dt>Important bug fixes:</dt>
2724
2725      <dd>
2726        <ul>
2727          <li>Updated {@code sys/atomics.h} to avoid correctness issues
2728            on some multi-core ARM-based devices. Rebuild your unmodified sources with this
2729            version of the NDK and this problem should be completely eliminated.
2730            For more details, read {@code docs/ANDROID-ATOMICS.html}.</li>
2731          <li>Reverted to {@code binutils} 2.19 to fix debugging issues that
2732            appeared in NDK r7 (which switched to {@code binutils} 2.20.1).</li>
2733          <li>Fixed {@code ndk-build} on 32-bit Linux. A packaging error put a 64-bit version
2734            of the {@code awk} executable under {@code prebuilt/linux-x86/bin} in NDK r7.</li>
2735          <li>Fixed native Windows build ({@code ndk-build.cmd}). Other build modes were not
2736            affected. The fixes include:
2737            <ul>
2738              <li>Removed an infinite loop / stack overflow bug that happened when trying
2739                to call {@code ndk-build.cmd} from a directory that was <em>not</em> the top of
2740                your project path (e.g., in any sub-directory of it).</li>
2741              <li>Fixed a problem where the auto-generated dependency files were ignored. This
2742                meant that updating a header didn't trigger recompilation of sources that included
2743                it.</li>
2744              <li>Fixed a problem where special characters in files or paths, other than spaces and
2745                quotes, were not correctly handled.</li>
2746            </ul>
2747          </li>
2748          <li>Fixed the standalone toolchain to generate proper binaries when using
2749            {@code -lstdc++} (i.e., linking against the GNU {@code libstdc++} C++ runtime). You
2750            should use {@code -lgnustl_shared} if you want to link against the shared library
2751            version or {@code -lstdc++} for the static version.
2752
2753            <p>See {@code docs/STANDALONE-TOOLCHAIN.html} for more details about this fix.</p>
2754          </li>
2755          <li>Fixed {@code gnustl_shared} on Cygwin. The linker complained that it couldn't find
2756            {@code libsupc++.a} even though the file was at the right location.</li>
2757          <li>Fixed Cygwin C++ link when not using any specific C++ runtime through
2758            {@code APP_STL}.</li>
2759        </ul>
2760      </dd>
2761    </dl>
2762
2763    <dl>
2764      <dt>Other changes:</dt>
2765
2766      <dd>
2767        <ul>
2768          <li>When your application uses the GNU {@code libstdc++} runtime, the compiler will
2769            no longer forcibly enable exceptions and RTTI. This change results in smaller code.
2770            <p>If you need these features, you must do one of the following:</p>
2771            <ul>
2772              <li>Enable exceptions and/or RTTI explicitly in your modules or
2773                {@code Application.mk}. (recommended)</li>
2774              <li>Define {@code APP_GNUSTL_FORCE_CPP_FEATURES} to {@code 'exceptions'},
2775                {@code 'rtti'} or both in your {@code Application.mk}. See
2776                {@code docs/APPLICATION-MK.html} for more details.</li>
2777            </ul>
2778          </li>
2779          <li>{@code ndk-gdb} now works properly when your application has private services
2780            running in independent processes. It debugs the main application process, instead of the
2781            first process listed by {@code ps}, which is usually a service process.</li>
2782          <li>Fixed a rare bug where NDK r7 would fail to honor the {@code LOCAL_ARM_MODE} value
2783            and always compile certain source files (but not all) to 32-bit instructions.</li>
2784          <li>{@code STLport}: Refresh the sources to match the Android platform version. This
2785            update fixes a few minor bugs:
2786            <ul>
2787               <li>Fixed instantiation of an incomplete type</li>
2788               <li>Fixed minor "==" versus "=" typo</li>
2789               <li>Used {@code memmove} instead of {@code memcpy} in {@code string::assign}</li>
2790               <li>Added better handling of {@code IsNANorINF}, {@code IsINF}, {@code IsNegNAN},
2791                 etc.</li>
2792             </ul>
2793             <p>For complete details, see the commit log.</p>
2794          </li>
2795          <li>{@code STLport}: Removed 5 unnecessary static initializers from the library.</li>
2796          <li>The GNU libstdc++ libraries for armeabi-v7a were mistakenly compiled for
2797            armeabi instead. This change had no impact on correctness, but using the right
2798            ABI should provide slightly better performance.</li>
2799          <li>The {@code cpu-features} helper library was updated to report three optional
2800            x86 CPU features ({@code SSSE3}, {@code MOVBE} and {@code POPCNT}). See
2801            {@code docs/CPU-FEATURES.html} for more details.</li>
2802          <li>{@code docs/NDK-BUILD.html} was updated to mention {@code NDK_APPLICATION_MK} instead
2803            of {@code NDK_APP_APPLICATION_MK} to select a custom {@code Application.mk} file.</li>
2804          <li>Cygwin: {@code ndk-build} no longer creates an empty "NUL" file in the current
2805            directory when invoked.</li>
2806          <li>Cygwin: Added better automatic dependency detection. In the previous version, it
2807            didn't work properly in the following cases:
2808            <ul>
2809              <li>When the Cygwin drive prefix was not {@code /cygdrive}.</li>
2810              <li>When using drive-less mounts, for example, when Cygwin would translate
2811                {@code /home} to {@code \\server\subdir} instead of {@code C:\Some\Dir}.</li>
2812            </ul>
2813          </li>
2814          <li>Cygwin: {@code ndk-build} does not try to use the native Windows tools under
2815            {@code $NDK/prebuilt/windows/bin} with certain versions of Cygwin and/or GNU Make.</li>
2816        </ul>
2817      </dd>
2818    </dl>
2819  </div>
2820</div>
2821
2822
2823<div class="toggle-content closed">
2824  <p><a href="#" onclick="return toggleContent(this)">
2825    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
2826      alt="">Android NDK, Revision 7</a> <em>(November 2011)</em>
2827  </p>
2828
2829  <div class="toggle-content-toggleme">
2830    <p>This release of the NDK includes new features to support the Android 4.0 platform as well
2831    as many other additions and improvements:</p>
2832
2833    <dl>
2834      <dt>New features</dt>
2835
2836      <dd>
2837        <ul>
2838          <li>Added official NDK APIs for Android 4.0 (API level 14), which adds the following
2839          native features to the platform:
2840
2841            <ul>
2842              <li>Added native multimedia API based on the Khronos Group OpenMAX AL? 1.0.1
2843              standard. The new <code>&lt;OMXAL/OpenMAXAL.h&gt;</code> and
2844              <code>&lt;OMXAL/OpenMAXAL_Android.h&gt;</code> headers allow applications targeting
2845              API level 14 to perform multimedia output directly from native code by using a new
2846              Android-specific buffer queue interface. For more details, see
2847              <code>docs/openmaxal/index.html</code> and <a href=
2848              "http://www.khronos.org/openmax/">http://www.khronos.org/openmax/</a>.</li>
2849
2850              <li>Updated the native audio API based on the Khronos Group OpenSL ES 1.0.1?
2851              standard. With API Level 14, you can now decode compressed audio (e.g. MP3, AAC,
2852              Vorbis) to PCM. For more details, see <code>docs/opensles/index.html</code> and
2853              <a href=
2854              "http://www.khronos.org/opensles">http://www.khronos.org/opensles/</a>.</li>
2855            </ul>
2856          </li>
2857
2858          <li>Added CCache support. To speed up large rebuilds, define the
2859          <code>NDK_CCACHE</code> environment variable to <code>ccache</code> (or the path to
2860          your <code>ccache</code> binary). When declared, the NDK build system automatically
2861          uses CCache when compiling any source file. For example:
2862            <pre>
2863export NDK_CCACHE=ccache
2864</pre>
2865          <p class="note"><strong>Note:</strong> CCache is not included in the NDK release
2866          so you must have it installed prior to using it. For more information about CCache, see
2867          <a href="http://ccache.samba.org">http://ccache.samba.org</a>.</p>
2868          </li>
2869
2870          <li>Added support for setting <code>APP_ABI</code> to <code>all</code> to indicate that
2871          you want to build your NDK modules for all the ABIs supported by your given NDK
2872          release. This means that either one of the following two lines in your
2873          <code>Application.mk</code> are equivalent with this release:
2874            <pre>
2875APP_ABI := all
2876APP_ABI := armeabi armeabi-v7a x86
2877</pre>
2878
2879            <p>This also works if you define <code>APP_ABI</code> when calling
2880            <code>ndk-build</code> from the command-line, which is a quick way to check that your
2881            project builds for all supported ABIs without changing the project's
2882            <code>Application.mk file</code>. For example:</p>
2883            <pre>
2884ndk-build APP_ABI=all
2885</pre>
2886          </li>
2887
2888          <li>Added a <code>LOCAL_CPP_FEATURES</code> variable in <code>Android.mk</code> that
2889          allows you to declare which C++ features (RTTI or Exceptions) your module uses. This
2890          ensures that the final linking works correctly if you have prebuilt modules that depend
2891          on these features. See <code>docs/ANDROID-MK.html</code> and
2892          <code>docs/CPLUSPLUS-SUPPORT.html</code> for more details.</li>
2893
2894          <li>Shortened paths to source and object files that are used in build commands. When
2895          invoking <code>$NDK/ndk-build</code> from your project path, the paths to the source,
2896          object, and binary files that are passed to the build commands are significantly
2897          shorter now, because they are passed relative to the current directory. This is useful
2898          when building projects with a lot of source files, to avoid limits on the maximum
2899          command line length supported by your host operating system. The behavior is unchanged
2900          if you invoke <code>ndk-build</code> from a sub-directory of your project tree, or if
2901          you define <code>NDK_PROJECT_PATH</code> to point to a specific directory.</li>
2902        </ul>
2903      </dd>
2904
2905      <dt>Experimental features</dt>
2906
2907      <dd>
2908        You can now build your NDK source files on Windows <em>without</em> Cygwin by calling the
2909        <code>ndk-build.cmd</code> script from the command line from your project path. The
2910        script takes exactly the same arguments as the original <code>ndk-build</code> script.
2911        The Windows NDK package comes with its own prebuilt binaries for GNU Make, Awk and other
2912        tools required by the build. You should not need to install anything else to get a
2913        working build system.
2914
2915        <p class="caution"><strong>Important:</strong> <code>ndk-gdb</code> does not work on
2916        Windows, so you still need Cygwin to debug.</p>
2917
2918        <p>This feature is still experimental, so feel free to try it and report issues on the
2919        <a href="http://b.android.com">public bug database</a> or <a href=
2920        "http://groups.google.com/group/android-ndk">public forum</a>. All samples and unit tests
2921        shipped with the NDK succesfully compile with this feature.</p>
2922      </dd>
2923
2924      <dt>Important bug fixes</dt>
2925
2926      <dd>
2927        <ul>
2928          <li>Imported shared libraries are now installed by default to the target installation
2929          location (<code>libs/&lt;abi&gt;</code>) if <code>APP_MODULES</code> is not defined in
2930          your <code>Application.mk</code>. For example, if a top-level module <code>foo</code>
2931          imports a module <code>bar</code>, then both <code>libfoo.so</code> and
2932          <code>libbar.so</code> are copied to the install location. Previously, only
2933          <code>libfoo.so</code> was copied, unless you listed <code>bar</code> in your
2934          <code>APP_MODULES</code> too. If you define <code>APP_MODULES</code> explicitly, the
2935          behavior is unchanged.</li>
2936
2937          <li><code>ndk-gdb</code> now works correctly for activities with multiple categories in
2938          their MAIN intent filters.</li>
2939
2940          <li>Static library imports are now properly transitive. For example, if a top-level
2941          module <code>foo</code> imports static library <code>bar</code> that imports static
2942          library <code>zoo</code>, the <code>libfoo.so</code> will now be linked against both
2943          <code>libbar.a</code> and <code>libzoo.a</code>.</li>
2944        </ul>
2945      </dd>
2946
2947      <dt>Other changes</dt>
2948
2949      <dd>
2950        <ul>
2951          <li><code>docs/NATIVE-ACTIVITY.HTML</code>: Fixed typo. The minimum API level should be
2952          9, not 8 for native activities.</li>
2953
2954          <li><code>docs/STABLE-APIS.html</code>: Added missing documentation listing EGL as a
2955          supported stable API, starting from API level 9.</li>
2956
2957          <li><code>download-toolchain-sources.sh</code>: Updated to download the toolchain
2958          sources from <a href="http://android.googlesource.com">android.googlesource.com</a>,
2959          which is the new location for the AOSP servers.</li>
2960
2961          <li>Added a new C++ support runtime named <code>gabi++</code>. More details about it
2962          are available in the updated <code>docs/CPLUSPLUS-SUPPORT.html</code>.</li>
2963
2964          <li>Added a new C++ support runtime named <code>gnustl_shared</code> that corresponds
2965          to the shared library version of GNU libstdc++ v3 (GPLv3 license). See more info at
2966          <code>docs/CPLUSPLUS-SUPPORT.html</code></li>
2967
2968          <li>Added support for RTTI in the STLport C++ runtimes (no support for
2969          exceptions).</li>
2970
2971          <li>Added support for multiple file extensions in <code>LOCAL_CPP_EXTENSION</code>. For
2972          example, to compile both <code>foo.cpp</code> and <code>bar.cxx</code> as C++ sources,
2973          declare the following:
2974            <pre>
2975LOCAL_CPP_EXTENSION := .cpp .cxx
2976</pre>
2977          </li>
2978
2979          <li>Removed many unwanted exported symbols from the link-time shared system libraries
2980          provided by the NDK. This ensures that code generated with the standalone toolchain
2981          doesn't risk to accidentally depend on a non-stable ABI symbol (e.g. any libgcc.a
2982          symbol that changes each time the toolchain used to build the platform is changed)</li>
2983
2984          <li>Refreshed the EGL and OpenGLES Khronos headers to support more extensions. Note
2985          that this does <em>not</em> change the NDK ABIs for the corresponding libraries,
2986          because each extension must be probed at runtime by the client application.
2987
2988            <p>The extensions that are available depend on your actual device and GPU drivers,
2989            not the platform version the device runs on. The header changes simply add new
2990            constants and types to make it easier to use the extensions when they have been
2991            probed with <code>eglGetProcAddress()</code> or <code>glGetProcAddress()</code>. The
2992            following list describes the newly supported extensions:</p>
2993
2994            <dl>
2995              <dt>GLES 1.x</dt>
2996
2997              <dd>
2998                <ul>
2999                  <li><code>GL_OES_vertex_array_object</code></li>
3000
3001                  <li><code>GL_OES_EGL_image_external</code></li>
3002
3003                  <li><code>GL_APPLE_texture_2D_limited_npot</code></li>
3004
3005                  <li><code>GL_EXT_blend_minmax</code></li>
3006
3007                  <li><code>GL_EXT_discard_framebuffer</code></li>
3008
3009                  <li><code>GL_EXT_multi_draw_arrays</code></li>
3010
3011                  <li><code>GL_EXT_read_format_bgra</code></li>
3012
3013                  <li><code>GL_EXT_texture_filter_anisotropic</code></li>
3014
3015                  <li><code>GL_EXT_texture_format_BGRA8888</code></li>
3016
3017                  <li><code>GL_EXT_texture_lod_bias</code></li>
3018
3019                  <li><code>GL_IMG_read_format</code></li>
3020
3021                  <li><code>GL_IMG_texture_compression_pvrtc</code></li>
3022
3023                  <li><code>GL_IMG_texture_env_enhanced_fixed_function</code></li>
3024
3025                  <li><code>GL_IMG_user_clip_plane</code></li>
3026
3027                  <li><code>GL_IMG_multisampled_render_to_texture</code></li>
3028
3029                  <li><code>GL_NV_fence</code></li>
3030
3031                  <li><code>GL_QCOM_driver_control</code></li>
3032
3033                  <li><code>GL_QCOM_extended_get</code></li>
3034
3035                  <li><code>GL_QCOM_extended_get2</code></li>
3036
3037                  <li><code>GL_QCOM_perfmon_global_mode</code></li>
3038
3039                  <li><code>GL_QCOM_writeonly_rendering</code></li>
3040
3041                  <li><code>GL_QCOM_tiled_rendering</code></li>
3042                </ul>
3043              </dd>
3044
3045              <dt>GLES 2.0</dt>
3046
3047              <dd>
3048                <ul>
3049                  <li><code>GL_OES_element_index_uint</code></li>
3050
3051                  <li><code>GL_OES_get_program_binary</code></li>
3052
3053                  <li><code>GL_OES_mapbuffer</code></li>
3054
3055                  <li><code>GL_OES_packed_depth_stencil</code></li>
3056
3057                  <li><code>GL_OES_texture_3D</code></li>
3058
3059                  <li><code>GL_OES_texture_float</code></li>
3060
3061                  <li><code>GL_OES_texture_float_linear</code></li>
3062
3063                  <li><code>GL_OES_texture_half_float_linear</code></li>
3064
3065                  <li><code>GL_OES_texture_npot</code></li>
3066
3067                  <li><code>GL_OES_vertex_array_object</code></li>
3068
3069                  <li><code>GL_OES_EGL_image_external</code></li>
3070
3071                  <li><code>GL_AMD_program_binary_Z400</code></li>
3072
3073                  <li><code>GL_EXT_blend_minmax</code></li>
3074
3075                  <li><code>GL_EXT_discard_framebuffer</code></li>
3076
3077                  <li><code>GL_EXT_multi_draw_arrays</code></li>
3078
3079                  <li><code>GL_EXT_read_format_bgra</code></li>
3080
3081                  <li><code>GL_EXT_texture_format_BGRA8888</code></li>
3082
3083                  <li><code>GL_EXT_texture_compression_dxt1</code></li>
3084
3085                  <li><code>GL_IMG_program_binary</code></li>
3086
3087                  <li><code>GL_IMG_read_format</code></li>
3088
3089                  <li><code>GL_IMG_shader_binary</code></li>
3090
3091                  <li><code>GL_IMG_texture_compression_pvrtc</code></li>
3092
3093                  <li><code>GL_IMG_multisampled_render_to_texture</code></li>
3094
3095                  <li><code>GL_NV_coverage_sample</code></li>
3096
3097                  <li><code>GL_NV_depth_nonlinear</code></li>
3098
3099                  <li><code>GL_QCOM_extended_get</code></li>
3100
3101                  <li><code>GL_QCOM_extended_get2</code></li>
3102
3103                  <li><code>GL_QCOM_writeonly_rendering</code></li>
3104
3105                  <li><code>GL_QCOM_tiled_rendering</code></li>
3106                </ul>
3107              </dd>
3108
3109              <dt>EGL</dt>
3110
3111              <dd>
3112                <ul>
3113                  <li><code>EGL_ANDROID_recordable</code></li>
3114
3115                  <li><code>EGL_NV_system_time</code></li>
3116                </ul>
3117              </dd>
3118            </dl>
3119          </li>
3120        </ul>
3121      </dd>
3122    </dl>
3123  </div>
3124</div>
3125
3126
3127<div class="toggle-content closed">
3128  <p><a href="#" onclick="return toggleContent(this)">
3129    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3130      alt="">Android NDK, Revision 6b</a> <em>(August 2011)</em>
3131  </p>
3132
3133  <div class="toggle-content-toggleme">
3134      <p>This release of the NDK does not include any new features compared to r6. The r6b release
3135      addresses the following issues in the r6 release:</p>
3136      <dl>
3137        <dt>Important bug fixes</dt>
3138        <dd>
3139          <ul>
3140            <li>Fixed the build when <code>APP_ABI="armeabi x86"</code> is used for
3141            multi-architecture builds.</li>
3142            <li>Fixed the location of prebuilt STLport binaries in the NDK release package.
3143            A bug in the packaging script placed them in the wrong location.</li>
3144            <li>Fixed <code>atexit()</code> usage in shared libraries with the x86standalone
3145            toolchain.</li>
3146            <li>Fixed <code>make-standalone-toolchain.sh --arch=x86</code>. It used to fail
3147            to copy the proper GNU libstdc++ binaries to the right location.</li>
3148            <li>Fixed the standalone toolchain linker warnings about missing the definition and
3149            size for the <code>__dso_handle</code> symbol (ARM only).</li>
3150            <li>Fixed the inclusion order of <code>$(SYSROOT)/usr/include</code> for x86 builds.
3151            See the <a href="http://b.android.com/18540">bug</a> for
3152            more information.</li>
3153            <li>Fixed the definitions of <code>ptrdiff_t</code> and <code>size_t</code> in
3154            x86-specific systems when they are used with the x86 standalone toolchain.</li>
3155          </ul>
3156        </dd>
3157      </dl>
3158  </div>
3159</div>
3160
3161<div class="toggle-content closed">
3162  <p><a href="#" onclick="return toggleContent(this)">
3163    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3164      alt="">Android NDK, Revision 6</a> <em>(July 2011)</em>
3165  </p>
3166
3167  <div class="toggle-content-toggleme">
3168      <p>This release of the NDK includes support for the x86 ABI and other minor changes.
3169      For detailed information describing the changes in this release, read the
3170      <code>CHANGES.HTML</code> document included in the NDK package.
3171      </p>
3172      <dl>
3173        <dt>General notes:</dt>
3174        <dd>
3175          <ul>
3176            <li>Adds support for the x86 ABI, which allows you to generate machine code
3177            that runs on compatible x86-based Android devices. Major features for x86
3178            include x86-specific toolchains, system headers, libraries and
3179            debugging support. For all of the details regarding x86 support,
3180            see <code>docs/CPU-X86.html</code> in the NDK package.
3181
3182              <p>By default, code is generated for ARM-based devices, but you can add x86 to your
3183              <code>APP_ABI</code> definition in your <code>Application.mk</code> file to build
3184              for x86 platforms. For example, the following line instructs <code>ndk-build</code>
3185              to build your code for three distinct ABIs:</p>
3186
3187              <pre>APP_ABI := armeabi armeabi-v7a x86</pre>
3188
3189              <p>Unless you rely on ARM-based assembly sources, you shouldn't need to touch
3190              your <code>Android.mk</code> files to build x86 machine code.</p>
3191
3192            </li>
3193
3194            <li>You can build a standalone x86 toolchain using the
3195<code>--toolchain=x86-4.4.3</code>
3196            option when calling <code>make-standalone-toolchain.sh</code>. See
3197            <code>docs/STANDALONE-TOOLCHAIN.html</code> for more details.
3198            </li>
3199            <li>The new <code>ndk-stack</code> tool lets you translate stack traces in
3200            <code>logcat</code> that are generated by native code. The tool translates
3201            instruction addresses into a readable format that contains things such
3202            as the function, source file, and line number corresponding to each stack frame.
3203            For more information and a usage example, see <code>docs/NDK-STACK.html</code>.
3204            </li>
3205          </ul>
3206        </dd>
3207        <dt>Other changes:</dt>
3208        <dd><code>arm-eabi-4.4.0</code>, which had been deprecated since NDK r5, has been
3209        removed from the NDK distribution.</dd>
3210
3211      </dl>
3212    </div>
3213  </div>
3214
3215<div class="toggle-content closed">
3216  <p><a href="#" onclick="return toggleContent(this)">
3217    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3218      alt="">Android NDK, Revision 5c</a> <em>(June 2011)</em>
3219  </p>
3220
3221  <div class="toggle-content-toggleme">
3222    <p>This release of the NDK does not include any new features compared to r5b. The r5c release
3223    addresses the following problems in the r5b release:</p>
3224    <dl>
3225      <dt>Important bug fixes:</dt>
3226      <dd>
3227        <ul>
3228          <li><code>ndk-build</code>: Fixed a rare bug that appeared when trying to perform parallel
3229          builds of debuggable projects.</li>
3230
3231          <li>Fixed a typo that prevented <code>LOCAL_WHOLE_STATIC_LIBRARIES</code> to work
3232          correctly with the new toolchain and added documentation for this in
3233          <code>docs/ANDROID-MK.html</code>.</li>
3234
3235          <li>Fixed a bug where code linked against <code>gnustl_static</code> crashed when run on
3236          platform releases older than API level 8 (Android 2.2).</li>
3237
3238          <li><code>ndk-gdb</code>: Fixed a bug that caused a segmentation fault when debugging
3239Android 3.0
3240          or newer devices.</li>
3241
3242          <li><code>&lt;android/input.h&gt;</code>: Two functions that were introduced in API level
3243          9 (Android 2.3) were incorrect and are fixed. While this breaks the source API, the
3244          binary interface to the system is unchanged. The incorrect functions were missing a
3245          <code>history_index</code> parameter, and the correct definitions are shown below:
3246<pre>
3247float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event,
3248                                           size_t pointer_index,
3249                                           size_t history_index);
3250
3251float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event,
3252                                           size_t pointer_index,
3253                                           size_t history_index);
3254</pre>
3255          </li>
3256
3257          <li>Updated the C library ARM binary for API level 9 (Android 2.3) to correctly expose at
3258          link time new functions that were added in that API level (for example,
3259          <code>pthread_rwlock_init</code>).</li>
3260
3261        </ul>
3262      </dd>
3263
3264      <dt>Minor improvements and fixes:</dt>
3265      <dd>
3266        <ul>
3267          <li>Object files are now always linked in the order they appear in
3268          <code>LOCAL_SRC_FILES</code>. This was not the case previously because the files were
3269          grouped by source extensions instead.</li>
3270
3271          <li>When <code>import-module</code> fails, it now prints the list of directories that
3272          were searched. This is useful to check that the <code>NDK_MODULE_PATH</code> definition
3273          used by the build system is correct.</li>
3274
3275          <li>When <code>import-module</code> succeeds, it now prints the directory where the
3276          module was found to the log (visible with <code>NDK_LOG=1</code>).</li>
3277
3278          <li>Increased the build speed of debuggable applications when there is a very large number
3279          of include directories in the project.</li>
3280
3281          <li><code>ndk-gdb</code>: Better detection of <code>adb shell</code> failures and improved
3282          error messages.</li>
3283
3284          <li><code>&lt;pthread.h&gt;</code>: Fixed the definition of
3285          <code>PTHREAD_RWLOCK_INITIALIZER</code> for API level 9 (Android 2.3) and higher.</li>
3286
3287          <li>Fixed an issue where a module could import itself, resulting in an infinite loop in
3288          GNU Make.</li>
3289
3290          <li>Fixed a bug that caused the build to fail if <code>LOCAL_ARM_NEON</code> was set to
3291          true (typo in <code>build/core/build-binary.mk</code>).</li>
3292
3293          <li>Fixed a bug that prevented the compilation of <code>.s</code> assembly files
3294          (<code>.S</code> files were okay).</li>
3295        </ul>
3296      </dd>
3297    </dl>
3298  </div>
3299</div>
3300
3301<div class="toggle-content closed">
3302  <p><a href="#" onclick="return toggleContent(this)">
3303    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3304      alt="">Android NDK, Revision 5b</a> <em>(January 2011)</em>
3305  </p>
3306
3307  <div class="toggle-content-toggleme">
3308      <p>This release of the NDK does not include any new features compared to r5. The r5b release
3309addresses the
3310      following problems in the r5 release:
3311      </p>
3312      <ul>
3313    <li>The r5 binaries required glibc 2.11, but the r5b binaries are generated with a special
3314    toolchain that targets glibc 2.7 or higher instead. The Linux toolchain binaries now run on
3315Ubuntu 8.04 or higher. </li>
3316    <li>Fixes a compiler bug in the arm-linux-androideabi-4.4.3 toolchain.
3317    The previous binary generated invalid thumb instruction sequences when
3318    dealing with signed chars.</li>
3319    <li>Adds missing documentation for the
3320    "gnustl_static" value for APP_STL, that allows you to link against
3321    a static library version of GNU libstdc++. </li> the
3322    <li>Fixed the following <code>ndk-build</code> issues:
3323      <ul>
3324        <li>A bug that created inconsistent dependency files when a
3325        compilation error occured on Windows. This prevented a proper build after
3326        the error was fixed in the source code.</li>
3327        <li>A Cygwin-specific bug where using very short paths for
3328        the Android NDK installation or the project path led to the
3329        generation of invalid dependency files. This made incremental builds
3330        impossible.</li>
3331        <li>A typo that prevented the cpufeatures library from working correctly
3332        with the new NDK toolchain.</li>
3333        <li>Builds in Cygwin are faster by avoiding calls to <code>cygpath -m</code>
3334        from GNU Make for every source or object file, which caused problems
3335        with very large source trees. In case this doesn't work properly, define
3336<code>NDK_USE_CYGPATH=1</code> in your
3337        environment to use <code>cygpath -m</code> again.</li>
3338        <li>The Cygwin installation now notifies the user of invalid installation paths that
3339contain spaces. Previously, an invalid path
3340        would output an error that complained about an incorrect version of GNU Make, even if the
3341right one was installed.
3342      </ul>
3343    </li>
3344  <li>Fixed a typo that prevented the <code>NDK_MODULE_PATH</code> environment variable from
3345working properly when
3346  it contained multiple directories separated with a colon. </li>
3347  <li>The <code>prebuilt-common.sh</code> script contains fixes to check the compiler for 64-bit
3348  generated machine code, instead of relying on the host tag, which
3349  allows the 32-bit toolchain to rebuild properly on Snow Leopard. The toolchain rebuild scripts
3350now also support
3351  using a 32-bit host toolchain.</li>
3352  <li>A missing declaration for <code>INET_ADDRSTRLEN</code> was added to
3353<code>&lt;netinet/in.h&gt;</code>.</li>
3354  <li>Missing declarations for <code>IN6_IS_ADDR_MC_NODELOCAL</code> and
3355<code>IN6_IS_ADDR_MC_GLOBAL</code> were added to <code>&lt;netinet/in6.h&gt;</code>.</li>
3356  <li>'asm' was replaced with '__asm__' in <code>&lt;asm/byteorder.h&gt;</code> to allow
3357compilation with <code>-std=c99</code>.</li>
3358  </ul>
3359  </div>
3360  </div>
3361
3362<div class="toggle-content closed">
3363  <p><a href="#" onclick="return toggleContent(this)">
3364    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3365      alt="">Android NDK, Revision 5</a> <em>(December 2010)</em>
3366  </p>
3367
3368  <div class="toggle-content-toggleme">
3369      <p>This release of the NDK includes many new APIs, most of which are introduced to
3370         support the development of games and similar applications that make extensive use
3371         of native code. Using the APIs, developers have direct native access to events, audio,
3372         graphics and window management, assets, and storage. Developers can also implement the
3373         Android application lifecycle in native code with help from the new
3374         {@link android.app.NativeActivity} class. For detailed information describing the changes
3375in this
3376         release, read the <code>CHANGES.HTML</code> document included in the downloaded NDK
3377package.
3378      </p>
3379      <dl>
3380        <dt>General notes:</dt>
3381        <dd>
3382          <ul>
3383            <li>Adds support for native activities, which allows you to implement the
3384            Android application lifecycle in native code.</li>
3385
3386            <li>Adds native support for the following:
3387
3388              <ul>
3389
3390                <li>Input subsystem (such as the keyboard and touch screen)</li>
3391
3392                <li>Access to sensor data (accelerometer, compass, gyroscope, etc).</li>
3393
3394                <li>Event loop APIs to wait for things such as input and sensor events.</li>
3395
3396                <li>Window and surface subsystem</li>
3397
3398                <li>Audio APIs based on the OpenSL ES standard that support playback and recording
3399                as well as control over platform audio effects</li>
3400
3401                <li>Access to assets packaged in an <code>.apk</code> file.</li>
3402
3403              </ul>
3404            </li>
3405
3406            <li>Includes a new toolchain (based on GCC 4.4.3), which generates better code, and can
3407also now
3408            be used as a standalone cross-compiler, for people who want to build their stuff with
3409            <code>./configure &amp;&amp; make</code>. See
3410            docs/STANDALONE-TOOLCHAIN.html for the details. The binaries for GCC 4.4.0 are still
3411provided,
3412            but the 4.2.1 binaries were removed.</li>
3413
3414            <li>Adds support for prebuilt static and shared libraries (docs/PREBUILTS.html) and
3415module
3416            exports and imports to make sharing and reuse of third-party modules much easier
3417            (docs/IMPORT-MODULE.html explains why).</li>
3418
3419            <li>Provides a default C++ STL implementation (based on STLport) as a helper module. It
3420can be used either
3421            as a static or shared library (details and usage examples are in
3422sources/android/stlport/README). Prebuilt
3423            binaries for STLport (static or shared) and GNU libstdc++ (static only) are also
3424provided if you choose to
3425            compile against those libraries instead of the default C++ STL implementation.
3426            C++ Exceptions and RTTI are not supported in the default STL implementation. For more
3427information, see
3428            docs/CPLUSPLUS-SUPPORT.HTML.</li>
3429
3430            <li>Includes improvements to the <code>cpufeatures</code> helper library that improves
3431reporting
3432            of the CPU type (some devices previously reported ARMv7 CPU when the device really was
3433an ARMv6). We
3434            recommend developers that use this library to rebuild their applications then
3435            upload to Google Play to benefit from the improvements.</li>
3436
3437            <li>Adds an EGL library that lets you create and manage OpenGL ES textures and
3438              services.</li>
3439
3440            <li>Adds new sample applications, <code>native-plasma</code> and
3441<code>native-activity</code>,
3442            to demonstrate how to write a native activity.</li>
3443
3444            <li>Includes many bugfixes and other small improvements; see docs/CHANGES.html for a
3445more
3446              detailed list of changes.</li>
3447          </ul>
3448        </dd>
3449      </dl>
3450    </div>
3451  </div>
3452
3453<div class="toggle-content closed">
3454  <p><a href="#" onclick="return toggleContent(this)">
3455    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3456      alt="">Android NDK, Revision 4b</a> <em>(June 2010)</em>
3457  </p>
3458
3459  <div class="toggle-content-toggleme">
3460      <dl>
3461        <dt>NDK r4b notes:</dt>
3462
3463        <dd>
3464          <p>Includes fixes for several issues in the NDK build and debugging scripts &mdash; if
3465          you are using NDK r4, we recommend downloading the NDK r4b build. For detailed
3466          information describing the changes in this release, read the CHANGES.TXT document
3467          included in the downloaded NDK package.</p>
3468        </dd>
3469      </dl>
3470
3471      <dl>
3472        <dt>General notes:</dt>
3473
3474        <dd>
3475          <ul>
3476            <li>Provides a simplified build system through the new <code>ndk-build</code> build
3477            command.</li>
3478
3479            <li>Adds support for easy native debugging of generated machine code on production
3480            devices through the new <code>ndk-gdb</code> command.</li>
3481
3482            <li>Adds a new Android-specific ABI for ARM-based CPU architectures,
3483            <code>armeabi-v7a</code>. The new ABI extends the existing <code>armeabi</code> ABI to
3484            include these CPU instruction set extensions:
3485
3486              <ul>
3487                <li>Thumb-2 instructions</li>
3488
3489                <li>VFP hardware FPU instructions (VFPv3-D16)</li>
3490
3491                <li>Optional support for ARM Advanced SIMD (NEON) GCC intrinsics and VFPv3-D32.
3492                Supported by devices such as Verizon Droid by Motorola, Google Nexus One, and
3493                others.</li>
3494              </ul>
3495            </li>
3496
3497            <li>Adds a new <code>cpufeatures</code> static library (with sources) that lets your
3498            app detect the host device's CPU features at runtime. Specifically, applications can
3499            check for ARMv7-A support, as well as VFPv3-D32 and NEON support, then provide separate
3500            code paths as needed.</li>
3501
3502            <li>Adds a sample application, <code>hello-neon</code>, that illustrates how to use the
3503            <code>cpufeatures</code> library to check CPU features and then provide an optimized
3504            code path using NEON instrinsics, if supported by the CPU.</li>
3505
3506            <li>Lets you generate machine code for either or both of the instruction sets supported
3507            by the NDK. For example, you can build for both ARMv5 and ARMv7-A architectures at the
3508            same time and have everything stored to your application's final
3509            <code>.apk</code>.</li>
3510
3511            <li>To ensure that your applications are available to users only if their devices are
3512            capable of running them, Google Play now filters applications based on the
3513            instruction set information included in your application &mdash; no action is needed on
3514            your part to enable the filtering. Additionally, the Android system itself also checks
3515            your application at install time and allows the installation to continue only if the
3516            application provides a library that is compiled for the device's CPU architecture.</li>
3517
3518            <li>Adds support for Android 2.2, including a new stable API for accessing the pixel
3519            buffers of {@link android.graphics.Bitmap} objects from native code.</li>
3520          </ul>
3521        </dd>
3522      </dl>
3523    </div>
3524  </div>
3525
3526<div class="toggle-content closed">
3527  <p><a href="#" onclick="return toggleContent(this)">
3528    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3529      alt="">Android NDK, Revision 3</a> <em>(March 2010)</em>
3530  </p>
3531
3532  <div class="toggle-content-toggleme">
3533      <dl>
3534        <dt>General notes:</dt>
3535
3536        <dd>
3537          <ul>
3538            <li>Adds OpenGL ES 2.0 native library support.</li>
3539
3540            <li>Adds a sample application,<code>hello-gl2</code>, that illustrates the use of
3541            OpenGL ES 2.0 vertex and fragment shaders.</li>
3542
3543            <li>The toolchain binaries have been refreshed for this release with GCC 4.4.0, which
3544            should generate slightly more compact and efficient machine code than the previous one
3545            (4.2.1). The NDK also still provides the 4.2.1 binaries, which you can optionally use
3546            to build your machine code.</li>
3547          </ul>
3548        </dd>
3549      </dl>
3550    </div>
3551  </div>
3552
3553<div class="toggle-content closed">
3554  <p><a href="#" onclick="return toggleContent(this)">
3555    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3556      alt="">Android NDK, Revision 2</a> <em>(September 2009)</em>
3557  </p>
3558
3559  <div class="toggle-content-toggleme">
3560      <p>Originally released as "Android 1.6 NDK, Release 1".</p>
3561
3562      <dl>
3563        <dt>General notes:</dt>
3564
3565        <dd>
3566          <ul>
3567            <li>Adds OpenGL ES 1.1 native library support.</li>
3568
3569            <li>Adds a sample application, <code>san-angeles</code>, that renders 3D graphics
3570            through the native OpenGL ES APIs, while managing activity lifecycle with a {@link
3571            android.opengl.GLSurfaceView} object.</li>
3572          </ul>
3573        </dd>
3574      </dl>
3575    </div>
3576  </div>
3577
3578<div class="toggle-content closed">
3579  <p><a href="#" onclick="return toggleContent(this)">
3580    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
3581      alt="">Android NDK, Revision 1</a> <em>(June 2009)</em>
3582  </p>
3583
3584  <div class="toggle-content-toggleme">
3585      <p>Originally released as "Android 1.5 NDK, Release 1".</p>
3586
3587      <dl>
3588        <dt>General notes:</dt>
3589
3590        <dd>
3591          <ul>
3592            <li>Includes compiler support (GCC) for ARMv5TE instructions, including Thumb-1
3593            instructions.</li>
3594
3595            <li>Includes system headers for stable native APIs, documentation, and sample
3596            applications.</li>
3597          </ul>
3598        </dd>
3599      </dl>
3600    </div>
3601  </div>
3602
3603
3604
3605
3606
3607<!-- ####################### END OF RELEASE NOTES ####################### -->
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636  <h2 id="Reqs">System and Software Requirements</h2>
3637
3638  <p>The sections below describe the system and software requirements for using the Android NDK, as
3639  well as platform compatibility considerations that affect appplications using libraries produced
3640  with the NDK.</p>
3641
3642  <h4>The Android SDK</h4>
3643
3644  <ul>
3645    <li>A complete Android SDK installation (including all dependencies) is required.</li>
3646
3647    <li>Android 1.5 SDK or later version is required.</li>
3648  </ul>
3649
3650  <h4>Supported operating systems</h4>
3651
3652  <ul>
3653    <li>Windows XP (32-bit) or Vista (32- or 64-bit)</li>
3654
3655    <li>Mac OS X 10.4.8 or later (x86 only)</li>
3656
3657    <li>Linux (32 or 64-bit; Ubuntu 8.04, or other Linux distributions using GLibc 2.7 or
3658later)</li>
3659  </ul>
3660
3661  <h4>Required development tools</h4>
3662
3663  <ul>
3664    <li>For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU
3665    Make might work but have not been tested.</li>
3666
3667    <li>A recent version of awk (either GNU Awk or Nawk) is also required.</li>
3668
3669    <li>For Windows, <a href="http://www.cygwin.com">Cygwin</a> 1.7 or higher is required. The NDK
3670    will <em>not</em> work with Cygwin 1.5 installations.</li>
3671  </ul>
3672
3673  <h4 id="platform-compat">Android platform compatibility</h4>
3674
3675  <ul>
3676    <li>The native libraries created by the Android NDK can only be used on devices running
3677      specific minimum Android platform versions. The minimum required platform version depends on
3678      the CPU architecture of the devices you are targeting. The following table details which
3679      Android platform versions are compatible with native code developed for specific CPU
3680      architectures.
3681
3682    <table style="margin:1em;">
3683      <tr>
3684        <th>Native Code CPU Architecture Used</th>
3685        <th>Compatible Android Platform(s)</th>
3686      </tr>
3687
3688      <tr>
3689        <td>ARM, ARM-NEON</td>
3690        <td>Android 1.5 (API Level 3) and higher</td>
3691      </tr>
3692
3693      <tr>
3694        <td>x86</td>
3695        <td>Android 2.3 (API Level 9) and higher</td>
3696      </tr>
3697
3698      <tr>
3699        <td>MIPS</td>
3700        <td>Android 2.3 (API Level 9) and higher</td>
3701      </tr>
3702    </table>
3703
3704      <p>These requirements mean you can use native libraries produced with the NDK in
3705      applications that are deployable to ARM-based devices running Android 1.5 or later. If you are
3706      deploying native libraries to x86 and MIPS-based devices, your application must target Android
3707      2.3 or later.</p>
3708    </li>
3709
3710    <li>To ensure compatibility, an application using a native library produced with the NDK
3711    <em>must</em> declare a <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code>
3712      &lt;uses-sdk&gt;</code></a> element in its manifest file, with an
3713      <code>android:minSdkVersion</code> attribute value of "3" or higher. For example:
3714
3715<pre style="margin:1em;">
3716&lt;manifest&gt;
3717  &lt;uses-sdk android:minSdkVersion="3" /&gt;
3718  ...
3719&lt;/manifest&gt;
3720</pre>
3721    </li>
3722
3723    <li>If you use this NDK to create a native library that uses the OpenGL ES APIs, the
3724    application containing the library can be deployed only to devices running the minimum platform
3725    versions described in the table below. To ensure compatibility, make sure that your application
3726    declares the proper <code>android:minSdkVersion</code> attribute value, as shown in the
3727    following table.</li>
3728
3729    <li style="list-style: none; display: inline">
3730      <table style="margin:1em;">
3731        <tr>
3732          <th>OpenGL ES Version Used</th>
3733
3734          <th>Compatible Android Platform(s)</th>
3735
3736          <th>Required uses-sdk Attribute</th>
3737        </tr>
3738
3739        <tr>
3740          <td>OpenGL ES 1.1</td>
3741
3742          <td>Android 1.6 (API Level 4) and higher</td>
3743
3744          <td><code>android:minSdkVersion="4"</code></td>
3745        </tr>
3746
3747        <tr>
3748          <td>OpenGL ES 2.0</td>
3749
3750          <td>Android 2.0 (API Level 5) and higher</td>
3751
3752          <td><code>android:minSdkVersion="5"</code></td>
3753        </tr>
3754      </table>
3755
3756      <p>For more information about API Level and its relationship to Android platform versions,
3757      see <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">Android API
3758Levels</a>.</p>
3759    </li>
3760
3761    <li>Additionally, an application using the OpenGL ES APIs should declare a
3762    <code>&lt;uses-feature&gt;</code> element in its manifest, with an
3763    <code>android:glEsVersion</code> attribute that specifies the minimum OpenGl ES version
3764    required by the application. This ensures that Google Play will show your application only
3765    to users whose devices are capable of supporting your application. For example:
3766      <pre style="margin:1em;">
3767&lt;manifest&gt;
3768<!-- Declare that the application uses the OpenGL ES 2.0 API and is designed
3769     to run only on devices that support OpenGL ES 2.0 or higher. -->
3770  &lt;uses-feature android:glEsVersion="0x00020000" /&gt;
3771  ...
3772&lt;/manifest&gt;
3773</pre>
3774
3775      <p>For more information, see the <a href=
3776
3777"{@docRoot}guide/topics/manifest/uses-feature-element.html"><code>&lt;uses-feature&gt;</code></a>
3778      documentation.</p>
3779    </li>
3780
3781    <li>If you use this NDK to create a native library that uses the API to access Android {@link
3782    android.graphics.Bitmap} pixel buffers or utilizes native activities, the application
3783    containing the library can be deployed only to devices running Android 2.2 (API level 8) or
3784    higher. To ensure compatibility, make sure that your application declares <code>&lt;uses-sdk
3785    android:minSdkVersion="8" /&gt;</code> attribute value in its manifest.</li>
3786  </ul>
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814  <h2 id="Installing">Installing the NDK</h2>
3815  <p>Installing the NDK on your development computer is straightforward and involves extracting the
3816  NDK from its download package.</p>
3817
3818  <p>Before you get started make sure that you have downloaded the latest <a href=
3819  "{@docRoot}sdk/index.html">Android SDK</a> and upgraded your applications and environment as
3820  needed. The NDK is compatible with older platform versions but not older versions of the SDK
3821tools.
3822  Also, take a moment to review the <a href="#Reqs">System and
3823Software Requirements</a>
3824  for the NDK, if you haven't already.</p>
3825
3826  <p>To install the NDK, first download the appropriate package from the table at the top of this
3827  page. Then, follow the procedure for your development platform:</p>
3828       <ul>
3829       <li>On Linux and Mac OS X (Darwin):
3830          <ul>
3831          <ol>
3832          <li>Download the appropriate package from this page.</li>
3833          <li>Open a terminal window.</li>
3834          <li>Go to the directory to which you downloaded the package.</li>
3835          <li>Run <code>chmod a+x</code> on the downloaded package.</li>
3836          <li>Execute the package. For example:</li>
3837          <pre>
3838ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
3839ndk$ ./android-ndk-r10c-darwin-x86_64.bin
3840          </pre>
3841          <p>The folder containing the NDK extracts itself.</p>
3842          <p>Note that you can also use a program like 7z to extract the package.</p>
3843          </ol>
3844          </ul>
3845    <li>On Windows:</li>
3846       <ul>
3847       <ol>
3848       <li>Download the appropriate package from this page.</li>
3849       <li>Navigate to the folder to which you downloaded the package.</li>
3850       <li>Double-click the downloaded file. The folder containing the NDK extracts itself.</li>
3851       </ol>
3852       </ul>
3853     </ul>When uncompressed, the NDK files are contained in a directory called
3854    <code>android-ndk-&lt;version&gt;</code>. You can rename the NDK directory if necessary and you
3855    can move it to any location on your computer. This documentation refers to the NDK directory as
3856    <code>&lt;ndk&gt;</code>.
3857
3858
3859  <p>You are now ready to start working with the NDK.</p>
3860
3861
3862<h2 id="GetStarted">Getting Started with the NDK</h2>
3863
3864<p>Once you've installed the NDK successfully, take a few minutes to read the documentation
3865included in the NDK. You can find the documentation in the <code>&lt;ndk&gt;/docs/</code>
3866directory. In particular, please read the OVERVIEW.HTML document completely, so that you
3867understand the intent of the NDK and how to use it.</p>
3868
3869<p>If you used a previous version of the NDK, take a moment to review the list of NDK changes in
3870the CHANGES.HTML document.</p>
3871
3872<p>Here's the general outline of how you work with the NDK tools:</p>
3873
3874<ol>
3875  <li>Place your native sources under <code>&lt;project&gt;/jni/...</code></li>
3876
3877  <li>Create <code>&lt;project&gt;/jni/Android.mk</code> to describe your native sources to the
3878  NDK build system</li>
3879
3880  <li>Optional: Create <code>&lt;project&gt;/jni/Application.mk</code>.</li>
3881
3882  <li>Build your native code by running the 'ndk-build' script from your project's directory. It
3883  is located in the top-level NDK directory:
3884    <pre class="no-pretty-print">cd &lt;project&gt;
3885&lt;ndk&gt;/ndk-build
3886</pre>
3887
3888    <p>The build tools copy the stripped, shared libraries needed by your application to the
3889    proper location in the application's project directory.</p>
3890  </li>
3891
3892  <li>Finally, compile your application using the SDK tools in the usual way. The SDK build tools
3893  will package the shared libraries in the application's deployable <code>.apk</code> file.</li>
3894</ol>
3895
3896<p>For complete information on all of the steps listed above, please see the documentation
3897included with the NDK package.</p>
3898
3899
3900<h3 id="Using">Using the NDK</h3>
3901
3902<p>The Android framework provides two ways to use native code:</p>
3903
3904<ul>
3905  <li>Write your application using the Android framework and use JNI to access the APIs provided
3906  by the Android NDK. This technique allows you to take advantage of the convenience of the
3907  Android framework, but still allows you to write native code when necessary. If you use this
3908  approach, your application must target specific, minimum Android platform levels, see <a
3909  href="#platform-compat">Android platform compatibility</a> for more information.</li>
3910
3911  <li>
3912    <p>Write a native activity, which allows you to implement the lifecycle callbacks in native
3913    code. The Android SDK provides the {@link android.app.NativeActivity} class, which is a
3914    convenience class that notifies your
3915    native code of any activity lifecycle callbacks (<code>onCreate()</code>,
3916<code>onPause()</code>,
3917    <code>onResume()</code>, etc). You can implement the callbacks in your native code to handle
3918    these events when they occur. Applications that use native activities must be run on Android
3919    2.3 (API Level 9) or later.</p>
3920
3921    <p>You cannot access features such as Services and Content Providers natively, so if you want
3922    to use them or any other framework API, you can still write JNI code to do so.</p>
3923  </li>
3924</ul>
3925
3926
3927
3928
3929
3930  <h2 id="Contents">Contents of the NDK</h2>
3931
3932  <p>The NDK contains the APIs, documentation, and sample
3933  applications that help you write your native code. Specifically:</p>
3934
3935  <ul>
3936    <li>A set of tools and build files used to generate native code libraries from C and C++
3937    sources</li>
3938
3939    <li>A way to embed the corresponding native libraries into an application package file
3940    (<code>.apk</code>) that can be deployed on Android devices</li>
3941
3942    <li>A set of native system headers and libraries that will be supported in all future versions
3943    of the Android platform, starting from Android 1.5. Applications that use native activities
3944    must be run on Android 2.3 or later.</li>
3945
3946    <li>Documentation, samples, and tutorials</li>
3947  </ul>
3948
3949  <p>The latest release of the NDK supports the following instruction sets:</p>
3950
3951  <ul>
3952    <li>ARMv5TE, including Thumb-1 instructions (see {@code docs/CPU-ARCH-ABIS.html} for more
3953information)</li>
3954
3955    <li>ARMv7-A, including Thumb-2 and VFPv3-D16 instructions, with optional support for
3956    NEON/VFPv3-D32 instructions (see {@code docs/CPU-ARM-NEON.html} for more information)</li>
3957
3958    <li>x86 instructions (see {@code docs/CPU-X86.html} for more information)</li>
3959
3960    <li>MIPS instructions (see {@code docs/CPU-MIPS.html} for more information)</li>
3961  </ul>
3962
3963  <p>ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on
3964  devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main
3965  difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and
3966  NEON instructions. You can target either or both of the instruction sets &mdash; ARMv5TE is the
3967  default, but switching to ARMv7-A is as easy as adding a single line to the application's
3968  <code>Application.mk</code> file, without needing to change anything else in the file. You can
3969also build for
3970  both architectures at the same time and have everything stored in the final <code>.apk</code>.
3971  Complete information is provided in the CPU-ARCH-ABIS.HTML in the NDK package.</p>
3972
3973  <p>The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES
3974  (3D graphics library), the JNI interface, and other libraries, as listed in the <a href=
3975  "#Tools">Development tools</a> section.</p>
3976
3977
3978  <h3 id="Tools">Development tools</h3>
3979
3980  <p>The NDK includes a set of cross-toolchains (compilers, linkers, etc.) that can generate
3981  native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms.</p>
3982
3983  <p>It provides a set of system headers for stable native APIs that are guaranteed to be supported
3984  in all later releases of the platform:</p>
3985
3986  <ul>
3987    <li>libc (C library) headers</li>
3988
3989    <li>libm (math library) headers</li>
3990
3991    <li>JNI interface headers</li>
3992
3993    <li>libz (Zlib compression) headers</li>
3994
3995    <li>liblog (Android logging) header</li>
3996
3997    <li>OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers</li>
3998
3999    <li>libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).</li>
4000
4001    <li>A Minimal set of headers for C++ support</li>
4002
4003    <li>OpenSL ES native audio libraries</li>
4004
4005    <li>Android native application APIS</li>
4006  </ul>
4007
4008  <p>The NDK also provides a build system that lets you work efficiently with your sources, without
4009  having to handle the toolchain/platform/CPU/ABI details. You create very short build files to
4010  describe which sources to compile and which Android application will use them &mdash; the build
4011  system compiles the sources and places the shared libraries directly in your application
4012  project.</p>
4013
4014  <p class="caution"><strong>Important:</strong> With the exception of the libraries listed above,
4015  native system libraries in the Android platform are <em>not</em> stable and may change in future
4016  platform versions. Your applications should <em>only</em> make use of the stable native system
4017  libraries provided in this NDK.</p>
4018
4019
4020
4021  <h3 id="Docs">Documentation</h3>
4022
4023  <p>The NDK package includes a set of documentation that describes the capabilities of the NDK and
4024  how to use it to create shared libraries for your Android applications. In this release, the
4025  documentation is provided only in the downloadable NDK package. You can find the documentation in
4026  the <code>&lt;ndk&gt;/docs/</code> directory. Included are these files (partial listing):</p>
4027
4028  <ul>
4029    <li>
4030    INSTALL.HTML &mdash; describes how to install the NDK and configure it for your host
4031    system</li>
4032
4033    <li>OVERVIEW.HTML &mdash; provides an overview of the NDK capabilities and usage</li>
4034
4035    <li>ANDROID-MK.HTML &mdash; describes the use of the Android.mk file, which defines the native
4036    sources you want to compile</li>
4037
4038    <li>APPLICATION-MK.HTML &mdash; describes the use of the Application.mk file, which describes
4039    the native sources required by your Android application</li>
4040    <li>CPLUSPLUS-SUPPORT.HTML &mdash; describes the C++ support provided in the Android NDK</li>
4041    <li>CPU-ARCH-ABIS.HTML &mdash; a description of supported CPU architectures and how to target
4042    them.</li>
4043
4044    <li>CPU-FEATURES.HTML &mdash; a description of the <code>cpufeatures</code> static library that
4045    lets your application code detect the target device's CPU family and the optional features at
4046    runtime.</li>
4047
4048    <li>CHANGES.HTML &mdash; a complete list of changes to the NDK across all releases.</li>
4049
4050    <li>DEVELOPMENT.HTML &mdash; describes how to modify the NDK and generate release packages for
4051it</li>
4052
4053    <li>HOWTO.HTML &mdash; information about common tasks associated with NDK development</li>
4054
4055    <li>IMPORT-MODULE.HTML &mdash; describes how to share and reuse modules</li>
4056
4057    <li>LICENSES.HTML  &mdash; information about the various open source licenses that govern the
4058Android NDK</li>
4059
4060    <li>NATIVE-ACTIVITY.HTML &mdash; describes how to implement native activities</li>
4061
4062    <li>NDK-BUILD.HTML &mdash; describes the usage of the ndk-build script</li>
4063
4064    <li>NDK-GDB.HTML &mdash; describes how to use the native code debugger</li>
4065
4066    <li>PREBUILTS.HTML &mdash; information about how shared and static prebuilt libraries work </li>
4067
4068    <li>STANDALONE-TOOLCHAIN.HTML &mdash; describes how to use Android NDK toolchain as a standalone
4069    compiler (still in beta).</li>
4070
4071    <li>SYSTEM-ISSUES.HTML &mdash; known issues in the Android system images that you should be
4072    aware of, if you are developing using the NDK.</li>
4073
4074    <li>STABLE-APIS.HTML &mdash; a complete list of the stable APIs exposed by headers in the
4075    NDK.</li>
4076
4077  </ul>
4078
4079  <p>Additionally, the package includes detailed information about the "bionic" C library provided
4080  with the Android platform that you should be aware of, if you are developing using the NDK. You
4081  can find the documentation in the <code>&lt;ndk&gt;/docs/system/libc/</code> directory:</p>
4082
4083  <ul>
4084    <li>OVERVIEW.HTML &mdash; provides an overview of the "bionic" C library and the features it
4085    offers.</li>
4086  </ul>
4087
4088
4089
4090
4091
4092<h3 id="Samples">Sample apps</h3>
4093
4094<p>The NDK includes sample applications that illustrate how to use native code in your Android
4095  applications:</p>
4096
4097  <ul>
4098    <li><code>hello-jni</code> &mdash; a simple application that loads a string from a native
4099    method implemented in a shared library and then displays it in the application UI.</li>
4100
4101    <li><code>two-libs</code> &mdash; a simple application that loads a shared library dynamically
4102    and calls a native method provided by the library. In this case, the method is implemented in a
4103    static library imported by the shared library.</li>
4104
4105    <li><code>san-angeles</code> &mdash; a simple application that renders 3D graphics through the
4106    native OpenGL ES APIs, while managing activity lifecycle with a {@link
4107    android.opengl.GLSurfaceView} object.</li>
4108
4109    <li><code>hello-gl2</code> &mdash; a simple application that renders a triangle using OpenGL ES
4110    2.0 vertex and fragment shaders.</li>
4111
4112    <li><code>hello-neon</code> &mdash; a simple application that shows how to use the
4113    <code>cpufeatures</code> library to check CPU capabilities at runtime, then use NEON intrinsics
4114    if supported by the CPU. Specifically, the application implements two versions of a tiny
4115    benchmark for a FIR filter loop, a C version and a NEON-optimized version for devices that
4116    support it.</li>
4117
4118    <li><code>bitmap-plasma</code> &mdash; a simple application that demonstrates how to access the
4119    pixel buffers of Android {@link android.graphics.Bitmap} objects from native code, and uses
4120    this to generate an old-school "plasma" effect.</li>
4121
4122    <li><code>native-activity</code> &mdash; a simple application that demonstrates how to use the
4123    native-app-glue static library to create a native activity</li>
4124
4125    <li><code>native-plasma</code> &mdash; a version of bitmap-plasma implemented with a native
4126    activity.</li>
4127  </ul>
4128
4129  <p>For each sample, the NDK includes the corresponding C source code and the necessary Android.mk
4130  and Application.mk files. There are located under <code>&lt;ndk&gt;/samples/&lt;name&gt;/</code>
4131  and their source code can be found under <code>&lt;ndk&gt;/samples/&lt;name&gt;/jni/</code>.</p>
4132
4133  <p>You can build the shared libraries for the sample apps by going into
4134  <code>&lt;ndk&gt;/samples/&lt;name&gt;/</code> then calling the <code>ndk-build</code> command.
4135  The generated shared libraries will be located under
4136  <code>&lt;ndk&gt;/samples/&lt;name&gt;/libs/armeabi/</code> for (ARMv5TE machine code) and/or
4137  <code>&lt;ndk&gt;/samples/&lt;name&gt;/libs/armeabi-v7a/</code> for (ARMv7 machine code).</p>
4138
4139  <p>Next, build the sample Android applications that use the shared libraries:</p>
4140
4141  <ul>
4142    <li>If you are developing in Eclipse with ADT, use the New Project Wizard to create a new
4143    Android project for each sample, using the "Import from Existing Source" option and importing
4144    the source from <code>&lt;ndk&gt;/samples/&lt;name&gt;/</code>. Then, set up an AVD,
4145    if necessary, and build/run the application in the emulator.</li>
4146
4147    <li>If you are developing with Ant, use the <code>android</code> tool to create the build file
4148    for each of the sample projects at <code>&lt;ndk&gt;/samples/&lt;name&gt;/</code>.
4149    Then set up an AVD, if necessary, build your project in the usual way, and run it in the
4150    emulator.</li>
4151
4152  </ul>
4153
4154  <p>For more information about developing with the Android SDK tools and what
4155  you need to do to create, build, and run your applications, see
4156  the <a href="{@docRoot}tools/workflow/index.html">Overview</a>
4157  section for developing on Android.</p>
4158
4159
4160
4161  <h4 id="hello-jni">Exploring the hello-jni Sample</h4>
4162
4163  <p>The hello-jni sample is a simple demonstration on how to use JNI from an Android application.
4164  The HelloJni activity receives a string from a simple C function and displays it in a
4165  TextView.</p>
4166
4167  <p>The main components of the sample include:</p>
4168
4169  <ul>
4170    <li>The familiar basic structure of an Android application (an <code>AndroidManifest.xml</code>
4171    file, a <code>src/</code> and <code>res</code> directories, and a main activity)</li>
4172
4173    <li>A <code>jni/</code> directory that includes the implemented source file for the native code
4174    as well as the Android.mk file</li>
4175
4176    <li>A <code>tests/</code> directory that contains unit test code.</li>
4177  </ul>
4178
4179  <ol>
4180    <li>Create a new project in Eclipse from the existing sample source or use the
4181    <code>android</code> tool to update the project so it generates a build.xml file that you can
4182    use to build the sample.
4183
4184      <ul>
4185        <li>In Eclipse:
4186
4187          <ol type="a">
4188            <li>Click <strong>File &gt; New Android Project...</strong></li>
4189
4190            <li>Select the <strong>Create project from existing source</strong> radio button.</li>
4191
4192            <li>Select any API level above Android 1.5.</li>
4193
4194            <li>In the <strong>Location</strong> field, click <strong>Browse...</strong> and select
4195            the <code>&lt;ndk-root&gt;/samples/hello-jni</code> directory.</li>
4196
4197            <li>Click <strong>Finish</strong>.</li>
4198          </ol>
4199        </li>
4200
4201        <li>On the command line:
4202
4203          <ol type="a">
4204            <li>Change to the <code>&lt;ndk-root&gt;/samples/hello-jni</code> directory.</li>
4205
4206            <li>Run the following command to generate a build.xml file:
4207              <pre class="no-pretty-print">android update project -p . -s</pre>
4208            </li>
4209          </ol>
4210        </li>
4211      </ul>
4212    </li>
4213
4214    <li>Compile the native code using the <code>ndk-build</code> command.
4215      <pre class="no-pretty-print">
4216cd &lt;ndk-root&gt;/samples/hello-jni
4217&lt;ndk_root&gt;/ndk-build
4218</pre>
4219    </li>
4220
4221    <li>Build and install the application as you would a normal Android application. If you are
4222    using Eclipse, run the application to build and install it on a device. If you are using Ant,
4223    run the following commands from the project directory:
4224      <pre class="no-pretty-print">
4225ant debug
4226adb install bin/HelloJni-debug.apk
4227</pre>
4228    </li>
4229  </ol>
4230
4231  <p>When you run the application on the device, the string <code>Hello JNI</code> should appear on
4232  your device. You can explore the rest of the samples that are located in the
4233  <code>&lt;ndk-root&gt;/samples</code> directory for more examples on how to use the JNI.</p>
4234
4235
4236
4237  <h4 id="native-activity">Exploring the native-activity Sample Application</h4>
4238
4239  <p>The native-activity sample provided with the Android NDK demonstrates how to use the
4240  android_native_app_glue static library. This static library makes creating a native activity
4241  easier by providing you with an implementation that handles your callbacks in another thread, so
4242  you do not have to worry about them blocking your main UI thread. The main parts of the sample
4243  are described below:</p>
4244
4245  <ul>
4246    <li>The familiar basic structure of an Android application (an <code>AndroidManifest.xml</code>
4247    file, a <code>src/</code> and <code>res</code> directories). The AndroidManifest.xml declares
4248    that the application is native and specifies the .so file of the native activity. See {@link
4249    android.app.NativeActivity} for the source or see the
4250    <code>&lt;ndk_root&gt;/platforms/samples/native-activity/AndroidManifest.xml</code> file.</li>
4251
4252    <li>A <code>jni/</code> directory contains the native activity, main.c, which uses the
4253    <code>android_native_app_glue.h</code> interface to implement the activity. The Android.mk that
4254    describes the native module to the build system also exists here.</li>
4255  </ul>
4256
4257  <p>To build this sample application:</p>
4258
4259  <ol>
4260    <li>Create a new project in Eclipse from the existing sample source or use the
4261    <code>android</code> tool to update the project so it generates a build.xml file that you can
4262    use to build the sample.
4263
4264      <ul>
4265        <li>In Eclipse:
4266
4267          <ol type="a">
4268            <li>Click <strong>File &gt; New Android Project...</strong></li>
4269
4270            <li>Select the <strong>Create project from existing source</strong> radio button.</li>
4271
4272            <li>Select any API level above Android 2.3.</li>
4273
4274            <li>In the <strong>Location</strong> field, click <strong>Browse...</strong> and select
4275            the <code>&lt;ndk-root&gt;/samples/native-activity</code> directory.</li>
4276
4277            <li>Click <strong>Finish</strong>.</li>
4278          </ol>
4279        </li>
4280
4281        <li>On the command line:
4282
4283          <ol type="a">
4284            <li>Change to the <code>&lt;ndk-root&gt;/samples/native-activity</code> directory.</li>
4285
4286            <li>Run the following command to generate a build.xml file:
4287              <pre class="no-pretty-print">
4288android update project -p . -s
4289</pre>
4290            </li>
4291          </ol>
4292        </li>
4293      </ul>
4294    </li>
4295
4296    <li>Compile the native code using the <code>ndk-build</code> command.
4297      <pre class="no-pretty-print">
4298cd &lt;ndk-root&gt;/platforms/samples/android-9/samples/native-activity
4299&lt;ndk_root&gt;/ndk-build
4300</pre>
4301    </li>
4302
4303    <li>Build and install the application as you would a normal Android application. If you are
4304    using Eclipse, run the application to build and install it on a device. If you are using Ant,
4305    run the following commands in the project directory, then run the application on the device:
4306      <pre class="no-pretty-print">
4307ant debug
4308adb install bin/NativeActivity-debug.apk
4309</pre>
4310    </li>
4311  </ol>
4312