am be4fc248: Merge "Docs: Final, master CL for NDK-docs-to-DAC for IO: "Guides," "Downloads" tabs." into mnc-preview-docs
* commit 'be4fc248b72e27dad6f677910566226c7dd9d670': Docs: Final, master CL for NDK-docs-to-DAC for IO: "Guides," "Downloads" tabs.
This commit is contained in:
@@ -6,12 +6,16 @@
|
||||
localized titles are added in the language order specified below.
|
||||
?>
|
||||
|
||||
|
||||
<ul id="nav">
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header empty"><a href="/ndk/downloads/index.html"><span class="en">
|
||||
NDK Download</span></a>
|
||||
</li>
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header empty"><a href="/ndk/downloads/index.html"><span class="en">
|
||||
Downloads</span></a></div>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header empty"><a href="/ndk/downloads/revision_history.html">
|
||||
<span class="en">Revision History</span></a></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -323,26 +323,59 @@ injunctive remedies (or an equivalent type of urgent legal relief) in any jurisd
|
||||
</div>
|
||||
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
<h2>In this document</h2>
|
||||
|
||||
<ol>
|
||||
<li><a href="#Downloads">Downloads</a></li>
|
||||
<li><a href="#rel">Release Notes</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Select, from the table below, the NDK package suitable for your development platform.</p>
|
||||
<p>Select, from the table below, the NDK package for your development platform. For information
|
||||
about the changes in the newest version of the NDK, see <a href="#rel">Release Notes</a>. For
|
||||
information about earlier revisions, see <a href="{@docRoot}ndk/downloads/revision_history.html">
|
||||
NDK Revision History.</a></p>
|
||||
|
||||
|
||||
<h2 id="Downloads">Downloads</h2>
|
||||
<h2 id="Downloads">Downloading</h2>
|
||||
|
||||
|
||||
<script>
|
||||
$('#Downloads').after($('#download-table'));
|
||||
</script>
|
||||
|
||||
<h2 id="extract">Extraction</h2>
|
||||
<p>The NDK package is a self-extracting binary. To unpack it, follow the procedure for your
|
||||
development platform:</p>
|
||||
<ul>
|
||||
<li>On Linux and Mac OS X (Darwin):
|
||||
<ul>
|
||||
<ol>
|
||||
<li>Download the appropriate package from this page.</li>
|
||||
<li>Open a terminal window.</li>
|
||||
<li>Go to the directory to which you downloaded the package.</li>
|
||||
<li>Run <code>chmod a+x</code> on the downloaded package.</li>
|
||||
<li>Execute the package. For example:
|
||||
<pre class="no-pretty-print">
|
||||
ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
|
||||
ndk$ ./android-ndk-r10c-darwin-x86_64.bin
|
||||
</pre></li>
|
||||
<p>The folder containing the NDK extracts itself.</p>
|
||||
<p>You can also use a program like 7z to extract the package.</p>
|
||||
</ol>
|
||||
</ul>
|
||||
</li>
|
||||
<li>On Windows:</li>
|
||||
<ul>
|
||||
<ol>
|
||||
<li>Download the appropriate package from this page.</li>
|
||||
<li>Navigate to the folder to which you downloaded the package.</li>
|
||||
<li>Double-click the downloaded file. The folder containing the NDK extracts itself.</li>
|
||||
</ol>
|
||||
</ul>
|
||||
</ul>When uncompressed, the NDK files are contained in a directory called
|
||||
<code>android-ndk-<version></code>. You can rename the NDK directory if necessary and you
|
||||
can move it to any location on your computer. This documentation refers to the NDK directory as
|
||||
<code><ndk></code>.
|
||||
|
||||
|
||||
<p>You are now ready to start working with the NDK.</p>
|
||||
|
||||
<h2 id="rel">Release Notes</h2>
|
||||
|
||||
<p>Android NDK, Revision 10e</a> <em>(May 2015)</em></p>
|
||||
|
||||
3237
docs/html-ndk/ndk/downloads/revision_history.jd
Normal file
3237
docs/html-ndk/ndk/downloads/revision_history.jd
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ page.title=ABI Management
|
||||
</div>
|
||||
|
||||
<p>Different Android handsets use different CPUs, which in turn support different instruction sets.
|
||||
Each combination of CPU and instruction set(s) has its own Application Binary Interface, or
|
||||
Each combination of CPU and instruction sets has its own Application Binary Interface, or
|
||||
<i>ABI</i>. The ABI defines, with great precision, how an application's machine code is supposed to
|
||||
interact with the system at runtime. You must specify an ABI for each CPU architecture you want
|
||||
your app to work with.</p>
|
||||
@@ -59,7 +59,7 @@ the instruction sets each ABI supports.</p>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#v7a">{@code armeabi-v7a}</a></td>
|
||||
<td><a href="#v7a">{@code armeabi-v7a} ({@code armeabi-v7a-hard)}</a></td>
|
||||
<td>
|
||||
<li>armeabi</li>
|
||||
<li>Thumb-2</li>
|
||||
@@ -158,7 +158,8 @@ functions from the compiler's {@code libgcc.a} static library.</p>
|
||||
<a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0210c/CACBCAAE.html">
|
||||
Thumb (a.k.a. Thumb-1) instruction set</a>. The NDK generates Thumb
|
||||
code by default unless you specify different behavior using the
|
||||
<code>LOCAL_ARM_MODE</code> variable in your <a href="android_mk.html"><code>Android.mk</code></a>
|
||||
<code>LOCAL_ARM_MODE</code> variable in your
|
||||
<a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a>
|
||||
file.</p>
|
||||
|
||||
<h3 id="v7a">armeabi-v7a (armeabi-v7a-hard)</h3>
|
||||
@@ -186,7 +187,7 @@ check is similar to the one that the system typically performs to check or use
|
||||
instruction sets on x86 CPUs.</p>
|
||||
|
||||
<p>For information about how to perform these runtime checks, refer to
|
||||
<a href="{@docRoot}ndk/guides/cpu-features.html">CPU Features</a>.
|
||||
<a href="{@docRoot}ndk/guides/cpu-features.html">The {@code cpufeatures} Library</a>.
|
||||
Also, for information about the NDK's support for building
|
||||
machine code for NEON, see
|
||||
<a href="{@docRoot}ndk/guides/cpu-arm-neon.html">NEON Support</a>.</p>
|
||||
@@ -250,7 +251,7 @@ The generated code is an optimization balanced across the top Intel 32-bit
|
||||
CPUs.</p>
|
||||
<p> For more information on compiler flags, particularly related to performance optimization,
|
||||
refer to <a href="http://software.intel.com/blogs/2012/09/26/gcc-x86-performance-hints">GCC
|
||||
x86 Performance</a>.</p>
|
||||
x86 performance hints</a>.</p>
|
||||
</li>
|
||||
<li>Use of the standard Linux x86 32-bit calling convention, as opposed to the one for SVR. For
|
||||
more information, see section 6, "Register Usage", of
|
||||
@@ -377,7 +378,7 @@ further information
|
||||
<h2 id="gc">Generating Code for a Specific ABI</h2>
|
||||
<p>By default, the NDK generates machine code for the armeabi ABI. You can
|
||||
generate ARMv7-a-compatible machine code, instead, by adding the following line
|
||||
to your <a href="{docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file.</p>
|
||||
to your <a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file.</p>
|
||||
<pre class="no-pretty-print">
|
||||
APP_ABI := armeabi-v7a
|
||||
</pre>
|
||||
@@ -391,7 +392,7 @@ APP_ABI := armeabi armeabi-v7a
|
||||
|
||||
<p>This setting tells the NDK to build two versions of your machine code: one
|
||||
for each ABI listed on this line. For more information on the values you can specify for the
|
||||
{@code APP_ABI} variable, see <a href="{docRoot}ndk/guides/android_mk.html">Android.mk</a>.
|
||||
{@code APP_ABI} variable, see <a href="{@docRoot}ndk/guides/android_mk.html">Android.mk</a>.
|
||||
</p>
|
||||
|
||||
<p>When you build multiple machine-code versions, the build system copies the libraries to your
|
||||
@@ -490,4 +491,4 @@ copies them to <code>/lib/lib<name>.so</code>, under the application's
|
||||
{@code data} directory ({@code data/data/<package_name>/lib/}).</p>
|
||||
|
||||
<p>If there is no shared-object file at all, the application builds and installs, but crashes at
|
||||
runtime.</p>
|
||||
runtime.</p>
|
||||
|
||||
@@ -9,9 +9,7 @@ page.title=Android.mk
|
||||
<li><a href="#over">Overview</a></li>
|
||||
<li><a href="#basics">Basics</a></li>
|
||||
<li><a href="#var">Variables and Macros</a></li>
|
||||
<li><a href="#npv">NDK-provided variables</a></li>
|
||||
<li><a href="#npfm">NDK-provided function macros</a></li>
|
||||
<li><a href="#mdv">Module-description variables</a></li>
|
||||
<li><a href="#mdv">Module-Description Variables</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,7 +22,8 @@ which glues your C and C++ source files to the Android NDK.</p>
|
||||
<p>The {@code Android.mk} file resides in a subdirectory of your project's {@code jni/} directory,
|
||||
and describes your sources and shared libraries to the build system. It is really a tiny GNU
|
||||
makefile fragment that the build system parses once or more. The {@code Android.mk} file is useful
|
||||
for defining project-wide settings that {@code Application.mk}, the build system, and your
|
||||
for defining project-wide settings that <a href="{@docRoot}ndk/guides/application_mk.html">{@code
|
||||
Application.mk}</a>, the build system, and your
|
||||
environment variables leave undefined. It can also override project-wide settings for specific
|
||||
<i>modules</i>.</p>
|
||||
|
||||
@@ -84,7 +83,7 @@ LOCAL_MODULE := hello-jni
|
||||
|
||||
<p>Each module name must be unique and not contain any spaces. The build system, when it
|
||||
generates the final shared-library file, automatically adds the proper prefix and suffix to
|
||||
the name that you assign to {@code LOCAL_MODULE|. For example, the example that appears above
|
||||
the name that you assign to {@code LOCAL_MODULE}. For example, the example that appears above
|
||||
results in generation of a library called {@code libhello-jni.so}.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> If your module's name already starts with {@code lib}, the
|
||||
@@ -114,10 +113,10 @@ information you defined in {@code LOCAL_XXX} variables since the most recent {@c
|
||||
script determines what to build, and how to do it.</p>
|
||||
|
||||
<p>There are more complex examples in the samples directories, with commented
|
||||
{@code Android.mk} files that you can look at. In addition, the
|
||||
<a href="{@docRoot}ndk/guides/native-activity.html">walkthrough</a> of the native-activity sample
|
||||
disucsses that sample's {@code Android.mk} file in some detail. Finally, the next section explains
|
||||
the variables from this section in a bit more detail.
|
||||
{@code Android.mk} files that you can look at. In addition,
|
||||
<a href="{@docRoot}ndk/guides/sample_na.html">Sample: native-activity</a> provides
|
||||
a detailed explanation of that sample's {@code Android.mk} file. Finally, <a href="#var">
|
||||
Variables and Macros</a> provides further information on the variables from this section.
|
||||
|
||||
|
||||
<h2 id="var">Variables and Macros</h2>
|
||||
@@ -155,7 +154,7 @@ include $(CLEAR_VARS)
|
||||
you provided in your {@code LOCAL_XXX} variables, and determines how to build a target shared
|
||||
library from the sources you listed. Note that using this script requires that you have already
|
||||
assigned values to {@code LOCAL_MODULE} and {@code LOCAL_SRC_FILES}, at a minimum (for more
|
||||
information about these variables, see <a href = "#mdv">Module-description variables</a>).</p>
|
||||
information about these variables, see <a href = "#mdv">Module-Description Variables</a>).</p>
|
||||
|
||||
<p>The syntax for using this variable is:</p>
|
||||
|
||||
@@ -190,23 +189,14 @@ include $(PREBUILT_SHARED_LIBRARY)
|
||||
</pre>
|
||||
|
||||
<p>You can also reference a prebuilt library in another module by using the
|
||||
{@code LOCAL_PREBUILTS} variable. The following example shows an example of using
|
||||
{@code LOCAL_PREBUILTS}:
|
||||
|
||||
<!--
|
||||
<pre class="no-pretty-print">
|
||||
(TODO: Example of referencing prebuilt library from another, using LOCAL_PREBUILTS.)
|
||||
</pre>
|
||||
-->
|
||||
|
||||
<p>For more information about using prebuilts, see <a href="{@docRoot}ndk/guides/prebuilts.html">
|
||||
NDK Prebuilt Library Support</a>.</p>
|
||||
{@code LOCAL_PREBUILTS} variable. For more information about using prebuilts, see
|
||||
<a href="{@docRoot}ndk/guides/prebuilts.html">Using Prebuilt Libraries</a>.</p>
|
||||
|
||||
|
||||
<h4>PREBUILT_STATIC_LIBRARY</h4>
|
||||
<p>The same as {@code PREBUILT_SHARED_LIBRARY}, but for a prebuilt static library. For more
|
||||
information about using prebuilts, see <a href="{@docRoot}ndk/guides/prebuilts.html">NDK Prebuilt
|
||||
Library Support</a>.</p>
|
||||
information about using prebuilts, see <a href="{@docRoot}ndk/guides/prebuilts.html">Using Prebuilt
|
||||
Libraries</a>.</p>
|
||||
|
||||
<h4>TARGET_ARCH</h4>
|
||||
<p>The name of the target CPU architecture as the Android Open Source Project specifies it.
|
||||
@@ -214,14 +204,13 @@ For any ARM-compatible build, use {@code arm}, independent of the CPU architectu
|
||||
ABI (see TARGET_ARCH_ABI, below).</p>
|
||||
|
||||
<p>The value of this variable is taken from the APP_ABI variable that you define in the
|
||||
<a href="{docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> file, which the system
|
||||
reads ahead of parsing the {@code Android.mk} file.</p>
|
||||
{@code Android.mk} file, which the system reads ahead of parsing the {@code Android.mk} file.</p>
|
||||
|
||||
<h4>TARGET_PLATFORM</h4>
|
||||
<p>The Android API level number for the build system to target.
|
||||
For example, the Android 5.1 system images correspond to Android API level 22: {@code android-22}.
|
||||
For a complete list of platform names and corresponding Android system
|
||||
images, see <a href="{@docRoot}ndk/guides/stable_apis.html">Android NDK Stable APIs</a>.
|
||||
images, see <a href="{@docRoot}ndk/guides/stable_apis.html">Android NDK Native APIs</a>.
|
||||
The following example shows the syntax for using this variable:</p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
@@ -242,36 +231,36 @@ supported CPU and architecture.
|
||||
<th scope="col">Setting</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">ARMv5TE</th>
|
||||
<th scope="col">{@code armeabi}</th>
|
||||
<td>ARMv5TE</td>
|
||||
<td>{@code armeabi}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">ARMv7</th>
|
||||
<th scope="col">{@code armeabi-v7a}</th>
|
||||
<td>ARMv7</td>
|
||||
<td>{@code armeabi-v7a}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">ARMv8 AArch64</th>
|
||||
<th scope="col">{@code arm64-v8a}</th>
|
||||
<td>ARMv8 AArch64</td>
|
||||
<td>{@code arm64-v8a}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">i686</th>
|
||||
<th scope="col">{@code x86}</th>
|
||||
<td>i686</td>
|
||||
<td>{@code x86}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">x86-64</th>
|
||||
<th scope="col">{@code x86_64}</th>
|
||||
<td>x86-64</td>
|
||||
<td>{@code x86_64}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">mips32 (r1)</th>
|
||||
<th scope="col">{@code mips}</th>
|
||||
<td>mips32 (r1)</td>
|
||||
<td>{@code mips}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">mips64 (r6)</th>
|
||||
<th scope="col">{@code mips64}</th>
|
||||
<td>mips64 (r6)</td>
|
||||
<td>{@code mips64}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">All</th>
|
||||
<th scope="col">{@code all}</th>
|
||||
<td>All</td>
|
||||
<td>{@code all}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -286,8 +275,7 @@ TARGET_ARCH_ABI := arm64-v8a
|
||||
|
||||
<p>For more details about architecture ABIs and associated compatibility
|
||||
issues, refer to
|
||||
<a href="{@docRoot}ndk/guides/md_3__key__topics__c_p_u__support__chapter_1-section_8__a_b_is.html">
|
||||
Android Native CPU ABI Management</a></p>
|
||||
<a href="{@docRoot}ndk/guides/abis.html">ABI Management</a>.</p>
|
||||
|
||||
<p>New target ABIs in the future will have different values.</p>
|
||||
|
||||
@@ -303,7 +291,7 @@ TARGET_ABI := android-22-arm64-v8a
|
||||
<p class="note"><strong>Note:</strong> Up to Android NDK 1.6_r1, the default value was
|
||||
{@code android-3-arm}.</p>
|
||||
|
||||
<h2 id="mdv">Module-description variables</h2>
|
||||
<h2 id="mdv">Module-Description Variables</h2>
|
||||
<p>The variables in this section describe your module to the build system. Each module description
|
||||
should follow this basic flow:
|
||||
<ul>
|
||||
@@ -332,7 +320,8 @@ to define it a single time, even if your {@code Android.mk} file describes multi
|
||||
and must not contain any spaces. You must define it before including any scripts (other than
|
||||
the one for {@code CLEAR_VARS}). You need not add either the {@code lib} prefix
|
||||
or the {@code .so} or {@code .a} file extension; the build system makes these modifications
|
||||
automatically. Throughout your {@code Android.mk} and {@code Application.mk} files, refer to
|
||||
automatically. Throughout your {@code Android.mk} and
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> files, refer to
|
||||
your module by its unmodified name. For example, the following line results in the generation of a
|
||||
shared library module called {@code libfoo.so}:</p>
|
||||
|
||||
@@ -365,8 +354,7 @@ module. Only list the files that the build system actually passes to the compile
|
||||
system automatically computes any associated depencies.</p>
|
||||
<p>Note that you can use both relative (to {@code LOCAL_PATH}) and absolute file paths.
|
||||
|
||||
<p>We recommend avoiding absolute file paths; relative paths make your
|
||||
<a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> file more
|
||||
<p>We recommend avoiding absolute file paths; relative paths make your {@code Android.mk} file more
|
||||
portable.</p>
|
||||
|
||||
<p class="note"><strong>Note: </strong> Always use Unix-style forward slashes (/) in build files.
|
||||
@@ -450,8 +438,8 @@ definitions or compile options.</p>
|
||||
|
||||
<p>Try not to change the optimization/debugging level in your {@code Android.mk} file.
|
||||
The build system can handle this setting automatically for you, using the relevant information
|
||||
in the {@code Application.mk} file. Doing it this way allows the build system to generate useful
|
||||
data files used during debugging.</p>
|
||||
in the <a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file. Doing it
|
||||
this way allows the build system to generate useful data files used during debugging.</p>
|
||||
|
||||
<p class="note"><strong>Note: </strong>In android-ndk-1.5_r1, the corresponding flags only applied
|
||||
to C source files, not C++ ones. They now match the full Android build system behavior.
|
||||
@@ -520,7 +508,7 @@ LOCAL_LDLIBS := -lz
|
||||
</pre>
|
||||
|
||||
<p>For the list of exposed system libraries against which you can link in this NDK release, see
|
||||
<a href="stable_apis.html">Android NDK Stable APIs</a>.</p>
|
||||
<a href="stable_apis.html">Android NDK Native APIs</a>.</p>
|
||||
|
||||
<p class="note"><strong>Note: </strong> If you define this variable for a static library,
|
||||
the build system ignores it, and {@code ndk-build} prints a warning.</p>
|
||||
@@ -574,22 +562,20 @@ LOCAL_SRC_FILES := foo.c bar.c.arm
|
||||
|
||||
<p class="note"><strong>Note: </strong> You can also force the build system to generate ARM binaries
|
||||
by setting {@code APP_OPTIM} in your
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html>{@code Application.mk}</a> file to {@code debug}.
|
||||
Specifying {@code debug} forces an ARM build because the toolchain debugger does not handle thumb
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file to {@code debug}.
|
||||
Specifying {@code debug} forces an ARM build because the toolchain debugger does not handle Thumb
|
||||
code properly.</p>
|
||||
|
||||
|
||||
<h4>LOCAL_ARM_NEON</h4>
|
||||
<p>This variable only matters when you are targetting the {@code armeabi-v7a} ABI. It allows the
|
||||
<p>This variable only matters when you are targeting the {@code armeabi-v7a} ABI. It allows the
|
||||
use of ARM Advanced SIMD (NEON) GCC intrinsics in your C and C++ sources, as well as NEON
|
||||
instructions in Assembly files.</p>
|
||||
|
||||
<p>Note that not all ARMv7-based CPUs support the NEON instruction set extensions. For this reason,
|
||||
you must perform runtime detection to be able to safely use this code at runtime. For more
|
||||
information, please see <a href="{@docRoot}ndk/guides/cpu_support.html">Android
|
||||
NDK & ARM NEON Instruction Set Extension Support</a> and <a
|
||||
href="{@docRoot}ndk/guides/cpu_features.html">Android
|
||||
NDK CPU Features Detection Library</a>.</p>
|
||||
information, see <a href="{@docRoot}ndk/guides/cpu-arm-neon.html">NEON Support</a> and <a
|
||||
href="{@docRoot}ndk/guides/cpu-features.html">The {@code cpufeatures} Library</a>.</p>
|
||||
|
||||
<p>Alternatively, you can use the {@code .neon} suffix to specify that the build system only
|
||||
compile specific source files with NEON support. In the following example, the build system compiles
|
||||
@@ -635,8 +621,8 @@ enhancements in RedHat Enterprise Linux (section 6)</a>.</p>
|
||||
|
||||
<p>By default, the build system compiles code with format string protection. Doing so forces a
|
||||
compiler error if a non-constant format string is used in a {@code printf}-style function.</p>
|
||||
<p>This protection is off by default, but you can disable it by setting its value to
|
||||
{@code true}. We do not recommend doing so without a compelling reason.</p>
|
||||
<p>This protection is on by default, but you can disable it by setting the value of
|
||||
this variable to {@code true}. We do not recommend doing so without a compelling reason.</p>
|
||||
|
||||
|
||||
<h4>LOCAL_EXPORT_CFLAGS</h4>
|
||||
@@ -729,7 +715,7 @@ individual source files, placing nearly all compiler flags inside list files, to
|
||||
|
||||
<p>Note that any value other than {@code true} will revert to the
|
||||
default behaviour. You can also define {@code APP_SHORT_COMMANDS} in your
|
||||
<a href="{docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file to force this
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file to force this
|
||||
behavior for all modules in your project.</p>
|
||||
|
||||
<p>We do not recommend enabling this feature by default, since it makes the build slower.</p>
|
||||
@@ -745,7 +731,8 @@ contain.</p>
|
||||
such libraries <em>cannot</em> be moved to a different location (all paths
|
||||
inside them are relative).</p>
|
||||
<p>Valid values are {@code true}, {@code false} or empty. A
|
||||
default value can be set in your {@code Application.mk} file through the {@code APP_THIN_ARCHIVE}
|
||||
default value can be set in your <a href="{@docRoot}ndk/guides/application_mk.html">
|
||||
{@code Application.mk}</a> file through the {@code APP_THIN_ARCHIVE}
|
||||
|
||||
variable.</p>
|
||||
<p class="note"><strong>Note:</strong> This is ignored for non-static library modules, or prebuilt
|
||||
@@ -785,7 +772,7 @@ myasmfilter $OBJS_DIR/foo.S.original $OBJS_DIR/foo.S
|
||||
myasmfilter bar.S $OBJS_DIR/bar.S
|
||||
</pre>
|
||||
|
||||
<h3 id="npfm">NDK-Provided Function Macros</h2>
|
||||
<h3 id="npfm">NDK-provided function macros</h2>
|
||||
<p>This section explains GNU Make function macros that the NDK provides. Use
|
||||
{@code $(call <function>)} to evaluate them; they return textual information.</p>
|
||||
|
||||
@@ -876,16 +863,16 @@ included the current one).</p>
|
||||
included the current one).</p>
|
||||
|
||||
<h4>import-module</h4>
|
||||
<p>A function that allows you to find and include the {@code Android.mk}
|
||||
of another module by name. A typical example is as follows: </p>
|
||||
<p>A function that allows you to find and include a module's {@code Android.mk} file by the name of
|
||||
the module. A typical example is as follows: </p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
$(call import-module,<name>)
|
||||
</pre>
|
||||
|
||||
<p>In this example, the build system looks for the module tagged <name> in the list of
|
||||
<p>In this example, the build system looks for the module tagged {@code <name>} in the list of
|
||||
directories referenced that your {@code NDK_MODULE_PATH} environment variable references, and
|
||||
includes its {@code Android.mk} file automatically for you.</p>
|
||||
|
||||
<p>For more information, see <a href="import_module.html">Android Module Paths (Sharing Code)</a>.
|
||||
<p>For more information, see <a href="import.html">Android Module Paths (Sharing Code)</a>.
|
||||
</p>
|
||||
|
||||
@@ -117,7 +117,7 @@ NDK's top-level directory.</p>
|
||||
|
||||
<h4>APP_ABI</h4>
|
||||
<p>By default, the NDK build system generates machine code for the
|
||||
<a href="{docRoot}ndk/guides/abis.html">{@code armeabi}</a> ABI. This machine code
|
||||
<a href="{@docRoot}ndk/guides/abis.html">{@code armeabi}</a> ABI. This machine code
|
||||
corresponds to an ARMv5TE-based CPU with software floating point operations. You can use
|
||||
{@code APP_ABI} to select a different ABI. Table 1 shows the {@code APP_ABI}
|
||||
settings for different instruction sets.</p>
|
||||
@@ -169,12 +169,12 @@ APP_ABI := armeabi armeabi-v7a x86 mips
|
||||
</pre>
|
||||
|
||||
<p>For the list of all supported ABIs and details about their usage and limitations, refer to
|
||||
<a href="{@docRoot}ndk/guides/abis.html">Android Native CPU ABI Management</a>.</p>
|
||||
<a href="{@docRoot}ndk/guides/abis.html">ABI Management</a>.</p>
|
||||
|
||||
<h4>APP_PLATFORM</h4>
|
||||
<p>This variable contains the name of the target Android platform. For example, {@code android-3}
|
||||
specifies the Android 1.5 system images. For a complete list of platform names and corresponding
|
||||
Android system images, see <a href="{@docRoot}ndk/guides/stable_apis.html">Android NDK Stable APIs
|
||||
Android system images, see <a href="{@docRoot}ndk/guides/stable_apis.html">Android NDK Native APIs
|
||||
</a>.</p>
|
||||
|
||||
<h4>APP_STL</h4>
|
||||
@@ -205,14 +205,14 @@ support for different libraries.</p>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>For more information on this subject, see <a href="{@docRoot}ndk/guides/cpp_support.html">C++
|
||||
Support</a>.</p>
|
||||
<p>For more information on this subject, see <a href="{@docRoot}ndk/guides/cpp-support.html">
|
||||
C++ Library Support</a>.</p>
|
||||
|
||||
|
||||
<h4>APP_SHORT_COMMANDS</h4>
|
||||
<p>The equivalent of {@code LOCAL_SHORT_COMMANDS} in {@code Application.mk} for your whole project.
|
||||
For more information, see the documentation for this variable on
|
||||
<a href="{docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a>.</p>
|
||||
<a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a>.</p>
|
||||
|
||||
<h4>NDK_TOOLCHAIN_VERSION</h4>
|
||||
<p>Define this variable as either {@code 4.9} or {@code 4.8} to select a version of the GCC
|
||||
@@ -237,5 +237,5 @@ libraries.</p>
|
||||
<h4>APP_THIN_ARCHIVE</h4>
|
||||
<p>Sets the default value of {@code LOCAL_THIN_ARCHIVE} in the {@code Android.mk} file for all
|
||||
static library modules in this project. For more information, see the documentation for
|
||||
{@code LOCAL_THIN_ARCHIVE} on <a href="{docRoot}ndk/guides/android_mk.html">{@code Android.mk}.</a>
|
||||
{@code LOCAL_THIN_ARCHIVE} on <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}.</a>
|
||||
</p>
|
||||
|
||||
@@ -1,31 +1,19 @@
|
||||
page.title=Architectures and CPUs
|
||||
page.title=CPUs and Architectures
|
||||
@jd:body
|
||||
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This section includes detailed information about ABIs and detailed information on support for respective instruction sets. It includes these topics:</p>
|
||||
<ul>
|
||||
<li><a href="./md_3__key__topics__c_p_u__support__chapter_1-section_8__a_b_is.html">ABI Management</a><ul>
|
||||
<li>Different ABIs support different CPUs and processing capabilities.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__c_p_u__support__c_p_u-_a_r_m-_n_e_o_n.html">Neon</a><ul>
|
||||
<li>Details about targeting devices whose CPUs support Neon, or Advanced SIMD. Neon is an optional extension of the armv7 architecture.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__c_p_u__support__c_p_u-_m_i_p_s.html">Mips</a><ul>
|
||||
<li>Details about targeting devices with CPUs supporting the MIPS32 instruction set.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__c_p_u__support__c_p_u-_x86.html">x86</a><ul>
|
||||
<li>Details about targeting devices with CPUs supporting the IA-32 instruction set.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__c_p_u__support__c_p_u-_x86-64.html">x86-64</a><ul>
|
||||
<li>Details about targeting devices whose CPUs support the x86-64 instruction set.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__c_p_u__support__c_p_u-_f_e_a_t_u_r_e_s.html">CPU Features</a><ul>
|
||||
<li>A small library that detects the target device's CPU family and supported features. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>When you're working with native code, hardware matters. The NDK lets you ensure you're compiling
|
||||
for the right architectures and CPUs by giving you a variety of ABIs from which
|
||||
to choose.</p>
|
||||
|
||||
<p>This section begins by explaining how to target specific
|
||||
<a href="{@docRoot}ndk/guides/abis.html">architectures and CPUs</a>. It then
|
||||
provides information you need to know when targeting the
|
||||
<a href="{@docRoot}ndk/guides/abis.html">ARM</a>
|
||||
family of CPUs and architectures. Next, it provides information about the other CPUs and
|
||||
architectures that it supports: <a href="{@docRoot}ndk/guides/cpu-arm-neon.html">NEON</a>, x86
|
||||
(<a href="{@docRoot}ndk/guides/x86.html">32-bit</a> and
|
||||
<a href="{@docRoot}ndk/guides/x86-64.html">64-bit</a>), and
|
||||
<a href="{@docRoot}ndk/guides/mips.html">MIPS</a>. Finally, it explains how to use the
|
||||
<a href="{@docRoot}ndk/guides/cpu-features.html">{@code cpufeatures}</a>
|
||||
library, which your app can use to query a given CPU and architecture about the optional
|
||||
features they support.</p>
|
||||
@@ -1,23 +1,18 @@
|
||||
page.title=Building
|
||||
page.title=Building Your Project
|
||||
@jd:body
|
||||
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This section explains, in detail, how to use the NDK to build your project. It comprises the following topics:</p>
|
||||
<ul>
|
||||
<li><a href="./md_3__key__topics__building__chapter_1-section_8_ndk-build.html">ndk-build</a><ul>
|
||||
<li>How to use the shell script that invokes the tools to build your shared libraries.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__building__chapter_1-section_8__android_8mk.html">Android.mk</a><ul>
|
||||
<li>Syntax for the file that describes your build sources to the build system.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__building__a_p_p_l_i_c_a_t_i_o_n-_m_k.html">Application.mk</a><ul>
|
||||
<li>Syntax for the file that describes the native modules that your application requires.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__building__s_t_a_n_d_a_l_o_n_e-_t_o_o_l_c_h_a_i_n.html">Standalone Toolchain</a><ul>
|
||||
<li>How to integrate the NDK into your existing build system. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>One of the NDK's core purposes is allowing you to build C and C++ source code into shared
|
||||
libraries that you can use in your app.</p>
|
||||
|
||||
<p>This section explains how to build native binaries for use in your Android app. It begins by
|
||||
explaining the
|
||||
<a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> file, which
|
||||
defines properties specific to individual <i>modules</i>, or libraries. Then, it explains the
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file, which defines
|
||||
properties for all the modules that you use in your
|
||||
app. Next, it tells you how to use the <a href="{@docRoot}ndk/guides/ndk-build.html">
|
||||
{@code ndk-build}</a> script, which is what the NDK uses to build your sources. Last, it ventures
|
||||
into advanced territory, discussing how to incorporate the NDK into your own
|
||||
<a href="{@docRoot}ndk/guides/standalone_toolchain.html">toolchain</a>, if you prefer to
|
||||
build that way instead of using
|
||||
<a href="{@docRoot}ndk/guides/ndk-build.html">{@code ndk-build}</a>.</p>
|
||||
@@ -23,7 +23,7 @@ page.title=Concepts
|
||||
<li>Already familiar with concepts inherent in native programming and in
|
||||
<a href="{@docRoot}">Android development</a>.</li>
|
||||
<li>Working in <a href="{@docRoot}sdk/index.html">Eclipse, and using the Android
|
||||
Development Tools ("ADT")</a>, except where otherwise noted.</li>
|
||||
Development Tools (ADT)</a>, except where otherwise noted.</li>
|
||||
</ul>
|
||||
<h2 id="intro">Introduction</h2>
|
||||
|
||||
@@ -53,14 +53,14 @@ scripts:
|
||||
<li>Generate binaries.</li>
|
||||
<li>Copy the binaries to your app's project path.</li>
|
||||
</ul>
|
||||
<p>For more information, see the
|
||||
<a href="{@docRoot}ndk/guides/ndk-build.html">ndk-build</a> section of this guide.</p>
|
||||
<p>For more information, see
|
||||
<a href="{@docRoot}ndk/guides/ndk-build.html">ndk-build</a>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li>Java: From your Java source, the Android build process generates {@code .dex}
|
||||
("Dalvik EXecutable") files, which are what the Android OS runs in the Dalvik Virtual Machine
|
||||
(Dalvik EXecutable) files, which are what the Android OS runs in the Dalvik Virtual Machine
|
||||
(“DVM”). Even if your app contains no Java source code at all, the build process still generates a
|
||||
{@code .dex} executable file within which the native component runs.
|
||||
|
||||
@@ -92,14 +92,14 @@ can link against other libraries.</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li>Java Native Interface ("JNI"): The JNI is the interface via which the Java and C++ components
|
||||
<li>Java Native Interface (JNI): The JNI is the interface via which the Java and C++ components
|
||||
talk to one another. This guide assumes knowledge of the JNI; for information about it, consult the
|
||||
<a href="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/jniTOC.html">
|
||||
Java Native Interface Specification</a>.</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li>Application Binary Interface ("ABI"): The ABI defines exactly how your app's machine code is
|
||||
<li>Application Binary Interface (ABI): The ABI defines exactly how your app's machine code is
|
||||
expected to interact with the system at runtime. The NDK builds {@code .so} files against these
|
||||
definitions. Different ABIs correspond to different architectures: The NDK includes ABI support for
|
||||
ARMEABI (default), MIPS, and x86. For more information, see
|
||||
@@ -109,9 +109,9 @@ ARMEABI (default), MIPS, and x86. For more information, see
|
||||
<ul>
|
||||
<li>Manifest: If you are writing an app with no Java component to it, you must declare the
|
||||
{@link android.app.NativeActivity} class in the
|
||||
<a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>. The
|
||||
<a href="#naa">Native Activity</a> section provides more detail on how to do this, under
|
||||
“Using the native-activity.h interface.”
|
||||
<a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>.
|
||||
<a href="#naa">Native Activities and Applications</a> provides more detail on how to do this, under
|
||||
“Using the {@code native-activity.h} interface.”
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -119,21 +119,22 @@ ARMEABI (default), MIPS, and x86. For more information, see
|
||||
the Android NDK as standalone compilers.</p>
|
||||
|
||||
<ul>
|
||||
<li>{@code Android.mk}: You must create an {@code Android.mk} configuration file inside your
|
||||
{@code jni} folder. The ndk-build script looks at this file, which defines the module and its name,
|
||||
the source files to be compiled, build flags and libraries to link. For more information, see the
|
||||
<a href="{@docRoot}ndk/guides/android.mk.html">Android.mk</a> section of this document.</li>
|
||||
<li>{@code Android.mk}: You must create an <a href="{@docRoot}ndk/guides/android_mk.html">
|
||||
{@code Android.mk}</a> configuration file inside your {@code jni} folder. The ndk-build script
|
||||
looks at this file, which defines the module and its name, the source files to be compiled, build
|
||||
flags and libraries to link.</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li>{@code Application.mk}: You may optionally create an Application.mk file. This file enumerates
|
||||
and describes the modules that your app requires. This information includes:<ul>
|
||||
<li>{@code Application.mk}: You may optionally create an
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file. This file
|
||||
This file enumerates and describes the modules that your app requires. This information includes:
|
||||
|
||||
<ul>
|
||||
<li>ABIs used to compile for specific platforms.</li>
|
||||
<li>Toolchains.</li>
|
||||
<li>Standard libraries to include (static and dynamic STLport or default system).</li>
|
||||
</ul>
|
||||
<p>For more information, see the
|
||||
<a href="{@docRoot}ndk/guides/application.mk.html">Application.mk</a> section.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -152,13 +153,14 @@ to find the Android Java framework useful for tasks including controlling the di
|
||||
<li>Create an Android app Project in Eclipse as you would for any other Android project.</li>
|
||||
<li>If you are writing a native-only app, declare the {@link android.app.NativeActivity} class in
|
||||
{@code AndroidManifest.xml}. You can do so from the Eclipse/ADT Android Manifest Editor, or by
|
||||
hand-editing the file. For more information, see the <a href="#naa">Native Activity</a> section.
|
||||
hand-editing the file. For more information, see the <a href="#naa">Native Activities and
|
||||
Applications</a>.
|
||||
</li>
|
||||
<li>Create an Android.mk file describing the native library, including name, flags, linked libraries
|
||||
and source files to be compiled in the ‘JNI’ directory.</li>
|
||||
<li>OPTIONAL: Create an {@code Application.mk} file configuring the target ABIs, toolchain,
|
||||
release/debug mode, and STL. For any of these that you do not specify, the following default values
|
||||
are used, respectively:
|
||||
<li>Create an {@code Android.mk} file describing the native library, including name, flags, linked
|
||||
libraries, and source files to be compiled in the ‘JNI’ directory.</li>
|
||||
<li>Optionally, you can create an {@code Application.mk} file configuring the target ABIs,
|
||||
toolchain, release/debug mode, and STL. For any of these that you do not specify, the following
|
||||
default values are used, respectively:
|
||||
<ul>
|
||||
<li>
|
||||
ABI: armeabi
|
||||
@@ -195,7 +197,7 @@ machine, sandboxed from other applications. You can therefore still access Andro
|
||||
through the JNI. In certain cases, however–such as for sensors, input events, and
|
||||
assets–the NDK provides native interfaces that you can use instead of having to call
|
||||
across the JNI. For more information about such support, see
|
||||
<a href="{@docRoot}ndk/guides/stable-apis.html">Stable APIs</a>.</p>
|
||||
<a href="{@docRoot}ndk/guides/stable_apis.html">Android NDK Native APIs</a>.</p>
|
||||
|
||||
<p>Regardless of whether or not you are developing a native activity, we recommend that you create
|
||||
your projects with the traditional Android build tools. Doing so helps ensure building and packaging
|
||||
@@ -265,25 +267,25 @@ library containing the entry point to the application (such as C/C++ {@code main
|
||||
function, which the app calls when the native activity starts. This function, analogous
|
||||
to {@code main} in C/C++, receives a pointer to an {@code ANativeActivity} structure,
|
||||
which contains function pointers to the various callback implementations that you need to write.
|
||||
Set the applicable callback function pointers in {@code ANativeActivity->;callbacks} to the
|
||||
Set the applicable callback function pointers in {@code ANativeActivity->callbacks} to the
|
||||
implementations of your callbacks.</li>
|
||||
|
||||
<!--TODO: API Ref links in the above para.-->
|
||||
|
||||
<li>Set the {@code ANativeActivity->;instance} field to the address of any instance of specific
|
||||
<li>Set the {@code ANativeActivity->instance} field to the address of any instance of specific
|
||||
data that you want to use.</li>
|
||||
<li>Implement anything else that you want your activity to do upon starting.</li>
|
||||
<li>Implement the rest of the callbacks that you set in {@code ANativeActivity->;callbacks}. For
|
||||
more information on when the callbacks are called, see the
|
||||
<a href="{@docRoot}training/basics/activity-lifecycle/index.html">SDK documentation for Activity Lifecycles</a>.
|
||||
<li>Implement the rest of the callbacks that you set in {@code ANativeActivity->callbacks}. For
|
||||
more information on when the callbacks are called, see
|
||||
<a href="{@docRoot}training/basics/activity-lifecycle/index.html">Managing the Activity
|
||||
Lifecycle</a>.
|
||||
</li>
|
||||
<li>Develop the rest of your application.</li>
|
||||
<li>Create an {@code Android.mk file} in the {@code jni/} directory of your project to describe your
|
||||
native module to the build system. For more information, see the
|
||||
<a href="./md_3__key__topics__building__chapter_1-section_8__android_8mk.html">Android.mk section.</a>.
|
||||
</li>
|
||||
<li>Once you have an {@code Android.mk} file, compile your native code using the {@code ndk-build}
|
||||
command.</li>
|
||||
native module to the build system. For more information, see
|
||||
<a href="{@docRoot}ndk/guides/android_mk.html">Android.mk</a>.</li>
|
||||
<li>Once you have an <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a>
|
||||
file, compile your native code using the {@code ndk-build} command.</li>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
$ cd <path>/<to>/<project>
|
||||
|
||||
@@ -114,7 +114,7 @@ APP_STL := gnustl_static
|
||||
For more information on how to use these runtimes with your own toolchain, see <a href="{@docRoot}ndk/guides/standalone_toolchain.html">Standalone Toolchain</a>.</p>
|
||||
|
||||
<h2 id="rc">Runtime Characteristics</h2>
|
||||
<h3 id="system">System runtime</h3>
|
||||
<h3 id="system">libstdc++ (default system runtime)</h3>
|
||||
|
||||
<p>This runtime only provides the following headers, with no support beyond them:</p>
|
||||
<ul>
|
||||
@@ -175,7 +175,7 @@ named {@code libgnustl_shared.so}.</p>
|
||||
shared library file is named {@code libc++_shared.so}.</p>
|
||||
|
||||
<p>By default, this runtime compiles with {@code -std=c++11}. As with GNU {@code libstdc++}, you
|
||||
need to explicitly turns on exceptions or rtti support. For information on how to do this, see
|
||||
need to explicitly turns on exceptions or RTTI support. For information on how to do this, see
|
||||
<a href="#xp">C++ Exceptions</a> and <a href="#rt">RTTI</a>.</p>
|
||||
|
||||
<p>The NDK provides prebuilt static and shared libraries for {@code libc++} compiled by Clang 3.4,
|
||||
@@ -235,9 +235,9 @@ compiles all C++ sources with {@code -fno-exceptions} support by default. You ca
|
||||
exceptions either for your entire app, or for individual modules.
|
||||
|
||||
<p>To enable exception-handling support for your entire app, add the following line to
|
||||
your <a href="{docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file.
|
||||
your <a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file.
|
||||
To enable exception-handling support for individual modules', add the following line to
|
||||
their respective <a href="{docRoot}ndk/guides/android.html">{@code Android.mk}</a> files.</p>
|
||||
their respective <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> files.</p>
|
||||
|
||||
<pre>
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
@@ -249,14 +249,14 @@ that support RTTI. However, to ensure compatibility with earlier releases, it co
|
||||
sources with {@code -fno-rtti} by default.
|
||||
|
||||
<p>To enable RTTI support for your entire app for your entire application, add the following line to
|
||||
your <a href="{docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file:
|
||||
your <a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a> file:
|
||||
|
||||
<pre>
|
||||
APP_CPPFLAGS += -frtti
|
||||
</pre>
|
||||
|
||||
To enable RTTI support for individual modules, add the following line to
|
||||
their respective <a href="{docRoot}ndk/guides/android.html">{@code Android.mk}</a> files:
|
||||
their respective <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> files:
|
||||
|
||||
<pre>
|
||||
LOCAL_CPP_FEATURES += rtti
|
||||
@@ -303,7 +303,7 @@ before any other library that depends on it.</p>
|
||||
<li>libstlport_shared.so, used by both libfoo and libbar</li>
|
||||
</ul>
|
||||
|
||||
<p>You must need to load the libraries in reverse dependency order: </p>
|
||||
<p>You must load the libraries in reverse dependency order: </p>
|
||||
<pre>
|
||||
static {
|
||||
System.loadLibrary("stlport_shared");
|
||||
@@ -325,4 +325,4 @@ more information, see <a href="http://gcc.gnu.org/onlinedocs/libstdc++/manual/li
|
||||
License</a> on the GCC website.</p>
|
||||
|
||||
<p><a href="https://llvm.org/svn/llvm-project/libcxx/trunk/LICENSE.TXT">LLVM {@code libc++}</a>
|
||||
is dual-licensed under both the University of Illinois "BSD-Like" license and the MIT license.</p>
|
||||
is dual-licensed under both the University of Illinois "BSD-Like" license and the MIT license.</p>
|
||||
|
||||
@@ -27,7 +27,7 @@ at the same time.</p>
|
||||
<p>Not all ARMv7-based Android devices support NEON, but devices that do may benefit significantly
|
||||
from its support for scalar/vector instructions. For x86 devices, the NDK can also translate NEON
|
||||
instructions into SSE, although with several restrictions. For more information, see
|
||||
<a href="{docRoot}ndk/guides/x86.html#an>x86 Support for ARM NEON Intrinsics.</a></p>
|
||||
<a href="{@docRoot}ndk/guides/x86.html#an">x86 Support for ARM NEON Intrinsics.</a></p>
|
||||
|
||||
<h2 id="ul">Using LOCAL_ARM_NEON</h2>
|
||||
<p>To have the NDK build all its source files with NEON support, include the following line in
|
||||
@@ -58,7 +58,7 @@ ARM instruction set for non-NEON instructions. In such a definition, {@code arm}
|
||||
<p>NEON support only works with the {@code armeabi-v7a} and {@code x86} ABIs. If the NDK build
|
||||
scripts encounter other ABIs while attempting to build with NEON support, the NDK build scripts
|
||||
exit. x86 provides <a href="x86.html">partial NEON support</a> via translation header. It is
|
||||
important to use checks like the following in your <a href="{docRoot}ndk/guides/android_mk.html">
|
||||
important to use checks like the following in your <a href="{@docRoot}ndk/guides/android_mk.html">
|
||||
{@code Android.mk}</a> file:</p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
@@ -76,7 +76,7 @@ endif # TARGET_ARCH_ABI == armeabi-v7a || x86
|
||||
<p>Your app must perform runtime detection to confirm that NEON-capable machine code can be run on
|
||||
the target device. This is because not all ARMv7-based Android devices support NEON. The app can
|
||||
perform this check using the
|
||||
<a href="{@docRoot}ndk/guides/cpu_features.html">{@code cpufeatures}</a> library that comes with
|
||||
<a href="{@docRoot}ndk/guides/cpu-features.html">{@code cpufeatures}</a> library that comes with
|
||||
this NDK.</p>
|
||||
|
||||
<p>You should explicitly check that {@code android_getCpuFamily()} returns {@code
|
||||
|
||||
@@ -98,7 +98,7 @@ this instruction set.</dd>
|
||||
|
||||
<dt>{@code ANDROID_CPU_ARM_FEATURE_ARMv7}</dt>
|
||||
<dd>Indicates that the device's CPU supports the ARMv7-A instruction set as supported by the
|
||||
<a href="{@docRoot}ndk/guides/abis.html">armeabi-v7a</a> ABI. This instruction set supports both
|
||||
<a href="{@docRoot}ndk/guides/abis.html#v7a">armeabi-v7a</a> ABI. This instruction set supports both
|
||||
Thumb-2 and VFPv3-D16 instructions. This return value also indicates support for the VFPv3 hardware
|
||||
FPU instruction-set extension.</dd>
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
page.title=Debugging
|
||||
page.title=Debugging Your Project
|
||||
@jd:body
|
||||
|
||||
<div class="title">Debugging </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This section introduces you to debugging with the NDK. It includes:</p>
|
||||
<ul>
|
||||
<li><a href="./md_3__key__topics__debugging__n_d_k-_g_d_b.html">ndk-gdb and ndk-gdb-py</a><ul>
|
||||
<li>The helper shell script named <code>ndk-gdb</code>, which allows you to launch a native debugging session for your NDK-generated machine code.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__debugging__n_d_k-_s_t_a_c_k.html">ndk-stack</a><ul>
|
||||
<li>A tool that helps you use ADB <code>logcat</code> in your debugging. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>After you've built your app, you'll probably need to debug it. This section introduces you to the
|
||||
NDK's debugging tools.</p>
|
||||
|
||||
<p>It begins by telling you how to use the <a href="{@docRoot}ndk/guides/ndk-gdb.html">
|
||||
{@code ndk-gdb}</a> tool to debug your code. It closes with an explanation of the
|
||||
<a href="{@docRoot}ndk/guides/ndk-stack.html">{@code ndk-stack}</a> tool, which helps you use the
|
||||
<a href="{@docRoot}tools/help/logcat.html">ADB logcat tool</a>
|
||||
as you debug.</p>
|
||||
@@ -8,64 +8,58 @@
|
||||
|
||||
<ul id="nav">
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header"><a href="/ndk/guides/index.html"><span class="en">
|
||||
Getting Started</span></a></div>
|
||||
<div class="nav-section-header"><a href="<?cs var:toroot ?>ndk/guides/index.html">
|
||||
<span class="en">Getting Started</span></a></div>
|
||||
<ul>
|
||||
<li><a href="setup.html">Setup</a></li>
|
||||
<li><a href="concepts.html">Concepts</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/setup.html">Setup</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/concepts.html">Concepts</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header"><a href="/ndk/guides/build.html"><span class="en">
|
||||
<div class="nav-section-header"><a href="<?cs var:toroot ?>ndk/guides/build.html">
|
||||
<span class="en">
|
||||
Building</span></a></div>
|
||||
<ul>
|
||||
<li><a href="#">ndk-build</a></li>
|
||||
<li><a href="#">Android.mk</a></li>
|
||||
<li><a href="#">Application.mk</a></li>
|
||||
<li><a href="#">Standalone Toolchain</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/android_mk.html">Android.mk</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/application_mk.html">Application.mk</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/ndk-build.html">ndk-build</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/standalone_toolchain.html">Standalone Toolchain
|
||||
</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header"><a href="/ndk/guides/debug.html"><span class="en">
|
||||
Debugging</span></a></div>
|
||||
<div class="nav-section-header"><a href="<?cs var:toroot ?>ndk/guides/arch.html">
|
||||
<span class="en">Architectures and CPUs</span></a></div>
|
||||
<ul>
|
||||
<li><a href="#">ndk-gdb</a></li>
|
||||
<li><a href="#">ndk-stack</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/abis.html">ABI Management</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/cpu-arm-neon.html">NEON</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/x86.html">x86</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/x86-64.html">x86-64</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/mips.html">MIPS</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/cpu-features.html">The cpufeatures Library</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header"><a href="/ndk/guides/arch.html"><span class="en">
|
||||
Architectures and CPUs</span></a></div>
|
||||
<div class="nav-section-header"><a href="<?cs var:toroot ?>ndk/guides/debug.html">
|
||||
<span class="en">Debugging</span></a></div>
|
||||
<ul>
|
||||
<li><a href="#">ABI Management</a></li>
|
||||
<li><a href="#">Neon</a></li>
|
||||
<li><a href="#">Mips</a></li>
|
||||
<li><a href="#">x86</a></li>
|
||||
<li><a href="#">x86-64</a></li>
|
||||
<li><a href="#">CPU Features</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/ndk-gdb.html">ndk-gdb</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/ndk-stack.html">ndk-stack</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header"><a href="/ndk/guides/libs.html"><span class="en">
|
||||
Libraries</span></a></div>
|
||||
<div class="nav-section-header"><a href="<?cs var:toroot ?>ndk/guides/libs.html">
|
||||
<span class="en">Libraries</span></a></div>
|
||||
<ul>
|
||||
<li><a href="#">Stable APIs</a></li>
|
||||
<li><a href="#">C++ Support</a></li>
|
||||
<li><a href="#">Prebuilt Libraries</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/prebuilts.html">Prebuilt Libraries</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/cpp-support.html">C++ Support</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/guides/stable_apis.html">Stable APIs</a></li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header"><a href="/ndk/guides/sample.html"><span class="en">
|
||||
Sample Walkthrough</span></a></div>
|
||||
<ul>
|
||||
<li><a href="#">hello-jni</a></li>
|
||||
<li><a href="#">native-activity</a></li>
|
||||
<li><a href="#">Teapot</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
page.title=Getting Started
|
||||
page.title=Getting Started with the NDK
|
||||
@jd:body
|
||||
|
||||
<p>This section provides the information you need to get up and running
|
||||
with the NDK.</p>
|
||||
<p>The Native Development Kit (NDK) is a set of tools that allow you to leverage C and
|
||||
C++ code in your Android apps. You can use it either to build from your own source code, or to take
|
||||
advantage of existing prebuilt libraries.</p>
|
||||
|
||||
<p>The NDK is not appropriate for most novice Android programmers, and has little value for many
|
||||
types of Android apps. It is often not worth the additional complexity it inevitably brings to the
|
||||
development process. However, it can be useful in cases in which you need to:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="setup.html">Setup</a></li>
|
||||
<ul>
|
||||
<li>Learn how to set up the NDK, and verify that it's integrated into
|
||||
your toolchain.</li>
|
||||
</ul>
|
||||
<li><a href="concepts.html">Concepts</a></li>
|
||||
<ul>
|
||||
<li>Learn some basics about how the NDK works and its components, and about how to use it.
|
||||
</li>
|
||||
</ul>
|
||||
<li>Squeeze extra performance out of a device for computationally intensive applications like
|
||||
games or physics simulations.</li>
|
||||
<li>Reuse your own or other developers' C or C++ libraries.</li>
|
||||
</ul>
|
||||
|
||||
<p>This guide gives you the information you need to get up and running with the NDK. It starts by
|
||||
explaining the <a href="{@docRoot}ndk/guides/concepts.html">concepts</a> underpinning the NDK, and
|
||||
how to <a href="{@docRoot}ndk/guides/setup.html">set it up</a>. Next, it explains how to use
|
||||
the NDK to <a href="{@docRoot}ndk/guides/build.html">build</a> and
|
||||
<a href="{@docRoot}ndk/guides/debug.html">debug</a> your app. Then, it continues with information
|
||||
about targeting <a href="{@docRoot}ndk/guides/arch.html">different hardware platforms</a> in your
|
||||
builds. Finally, it discusses how to use your own and other prebuilt
|
||||
<a href="{@docRoot}ndk/guides/libs.html">libraries</a>.</p>
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
page.title=Libraries
|
||||
page.title=Using Existing Libraries
|
||||
@jd:body
|
||||
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This section discusses libraries included with the NDK, as well as how to use other people's libraries and modules in your own application. It discusses:</p>
|
||||
<ul>
|
||||
<li><a href="./md_3__key__topics__libraries__s_t_a_b_l_e-_a_p_i_s.html">Stable APIs</a><ul>
|
||||
<li>This section discusses the stable APIs exposed by the NDK.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__libraries__p_r_e_b_u_i_l_t_s.html">Prebuilt Libraries</a><ul>
|
||||
<li>How to include and use prebuilt libraries in your own application.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./md_3__key__topics__libraries__c_p_l_u_s_p_l_u_s-_s_u_p_p_o_r_t.html">C++ Support</a><br/>
|
||||
<ul>
|
||||
<li>Information about the NDK's C++ runtime support library and corresponding header files. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>This section discusses the use of existing libraries–both your own, and those that the NDK
|
||||
provides.</p>
|
||||
|
||||
<p>It begins by telling you how to use your own <a href="{@docRoot}ndk/guides/prebuilts.html">
|
||||
prebuilt libraries</a>. Then, it explains the <a href="{@docRoot}ndk/guides/cpp-support.html">
|
||||
C++ helper runtimes</a> available with the NDK, and how to use them. Finally, it provides
|
||||
information on <a href="{@docRoot}ndk/guides/stable_apis.html">the other libraries</a> that the NDK provides, such
|
||||
as <a href="https://www.khronos.org/opengles/">OpenGL ES</a> and
|
||||
<a href="https://www.khronos.org/opensles/">OpenSL ES</a>, and the minimum Android API levels
|
||||
required to support those libraries.</p>
|
||||
@@ -29,7 +29,7 @@ APP_ABI := mips
|
||||
|
||||
<p>The build system places generated libraries into {@code $PROJECT/libs/mips/}, where
|
||||
{@code $PROJECT} represents your project's root directory, and embeds them in your APK under
|
||||
{@code /lib/mips/}.</p>
|
||||
the {@code /lib/mips/} directory.</p>
|
||||
|
||||
<p>The Android package manager extracts these libraries when installing your APK on a compatible
|
||||
MIPS-based device, placing them under your app's private data directory.</p>
|
||||
|
||||
@@ -9,7 +9,7 @@ page.title=ndk-build
|
||||
<li><a href="#int">Internals</a></li>
|
||||
<li><a href="#ifc">Invoking from the Command Line</a></li>
|
||||
<li><a href="#ife">Invoking from Eclipse</a></li>
|
||||
<li><a href="#6432">64-bit and 32-bit toolchains</a></li>
|
||||
<li><a href="#6432">64-Bit and 32-Bit Toolchains</a></li>
|
||||
<li><a href="#req">Requirements</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
@@ -17,12 +17,12 @@ page.title=ndk-build
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>ndk-build is a tiny shell script introduced in Android NDK r4. Its purpose
|
||||
is simply to invoke the right NDK build script.
|
||||
<p>The {@code ndk-build} file is a shell script introduced in Android NDK r4. Its purpose
|
||||
is to invoke the right NDK build script.
|
||||
|
||||
<h2 id="int">Internals</h2>
|
||||
|
||||
ndk-build is equivalent to: </p>
|
||||
<p>Running the {@code ndk-build} script is equivalent to running the following command:</p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
$GNUMAKE -f <ndk>/build/core/build-local.mk
|
||||
@@ -35,8 +35,8 @@ this information to invoke ndk-build from other shell scripts, or even your own
|
||||
make files.</p>
|
||||
|
||||
<h2 id="ifc">Invoking from the Command Line</h2>
|
||||
<p>ndk-build lives in the top level the NDK installation directory. To run it from the
|
||||
command line, invoke it while in or under your application project directory.
|
||||
<p>The {@code ndk-build} file lives in the top level the NDK installation directory. To run it
|
||||
from the command line, invoke it while in or under your application project directory.
|
||||
For example: </p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
@@ -132,7 +132,7 @@ results of each possible combination of settings.</p>
|
||||
Optimized*3 </td></tr>
|
||||
</table>
|
||||
*1: Useful for profiling.<br>
|
||||
*2: Default for running <a href="{@docRoot}ndk/guides/"ndk-gdb.html">ndk-gdb</a>.<br>
|
||||
*2: Default for running <a href="{@docRoot}ndk/guides/ndk-gdb.html">{@code ndk-gdb}</a>.<br>
|
||||
*3: Default mode.<br>
|
||||
<br>
|
||||
<p class="note"><strong>Note:</strong> {@code NDK_DEBUG=0} is the equivalent of
|
||||
@@ -159,7 +159,7 @@ From SDK r8 onward, you do not need to touch {@code AndroidManifest.xml}. Buildi
|
||||
pick the native debug files generated with {@code NDK_DEBUG=1}.
|
||||
|
||||
|
||||
<h2 id="6432">64-bit and 32-bit toolchains</h2>
|
||||
<h2 id="6432">64-Bit and 32-Bit Toolchains</h2>
|
||||
<p>Some toolchains come with both 64-bit and 32-bit versions. For example,
|
||||
directories {@code <ndk>/toolchain/<name>/prebuilt/} and
|
||||
{@code <ndk>/prebuilt/} may contain both {@code linux-x86} and
|
||||
|
||||
@@ -29,12 +29,12 @@ true}.</li>
|
||||
<li>Build your app to run on Android 2.2 (Android API level 8) or higher.</li>
|
||||
<li>Debug on a device or emulator running Android 2.2 or higher. For debugging purposes, the target
|
||||
API level that you declare in your {@code AndroidManifest.xml} file does not matter.</li>
|
||||
<li>Develop your app in a Unix shell. On Windows, use <a href="https://www.cygwin.com/">Cygwin
|
||||
<li>Develop your app in a Unix shell. On Windows, use <a href="https://www.cygwin.com/">Cygwin</a>
|
||||
or the experimental {@code ndk-gdb-py} <a href="https://www.python.org/">Python</a>
|
||||
implementation.</li>
|
||||
<li>Use GNU Make 3.81 or higher.</li>
|
||||
<li>If you are building your app from
|
||||
<a href="http://developer.android.com/sdk/installing/installing-adt.html">Eclipse</a>, build it
|
||||
<a href="{@docRoot}sdk/installing/installing-adt.html">Eclipse</a>, build it
|
||||
using version 0.9.7 or higher of the ADT plug-in.</li>
|
||||
|
||||
<h2 id="use">Usage</h2>
|
||||
@@ -150,7 +150,7 @@ line.</p>
|
||||
|
||||
<tr>
|
||||
<td>{@code --adb=<file>}</td>
|
||||
<td><p>This option specifies the <a href="http://developer.android.com/tools/help/adb.html">adb</a>
|
||||
<td><p>This option specifies the <a href="{@docRoot}tools/help/adb.html">adb</a>
|
||||
tool executable. It is only necessary if you have not set your path to include that executable.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -12,8 +12,10 @@ page.title=ndk-stack
|
||||
</div>
|
||||
|
||||
<p>The {@code ndk-stack} tool allows you to filter stack traces as they appear in the
|
||||
output of {@code adb logcat}, and replace any address inside a shared library with the corresponding
|
||||
{@code <source-file>:<line-number>} values.</p>
|
||||
output of <a href="{@docRoot}tools/help/logcat.html">{@code adb logcat}</a>. It also replaces any
|
||||
address inside a shared library with the corresponding
|
||||
{@code <source-file>:<line-number>} values from your source code, making issues easier
|
||||
to pinpoint.</p>
|
||||
|
||||
<p>For example, it translates something like:</p>
|
||||
|
||||
@@ -36,7 +38,7 @@ I/DEBUG ( 31): #06 pc 0000d362 /system/lib/libc.so
|
||||
I/DEBUG ( 31):
|
||||
</pre>
|
||||
|
||||
<p>Into the more readable output: </p>
|
||||
<p>into the more readable output: </p>
|
||||
|
||||
<pre>
|
||||
********** Crash dump: **********
|
||||
|
||||
@@ -42,7 +42,7 @@ use cases for this functionality:</p>
|
||||
whether you are using a shared ({@code .so}) or static {@code .a}) library.</li>
|
||||
</ol>
|
||||
|
||||
<p>Here is a trivial example that assumes that the prebuilt library {@code libfoo.so} resides in
|
||||
<p>Here is a trivial example that assumes the prebuilt library {@code libfoo.so} resides in
|
||||
the same directory as the <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a>
|
||||
file that describes it.</p>
|
||||
|
||||
@@ -142,4 +142,4 @@ include $(PREBUILT_SHARED_LIBRARY)
|
||||
<p>If you have specified {@code armeabi} as the value of {@code TARGET_ARCH_ABI}, the build system
|
||||
uses the version of {@code libfoo.so} located in the {@code armeabi} directory. If you have
|
||||
specified {@code x86} as the value {@code TARGET_ARCH_ABI}, the build system uses the version in the
|
||||
{@code x86} directory.</p>
|
||||
{@code x86} directory.</p>
|
||||
|
||||
@@ -1,520 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
||||
<meta name="Description" content="This document explains how to: This document assumes that you are already familiar with Java-based Android development. For more information on that topic, see the Android developer site . To install and configure the NDK, follow these steps: Eclipse …">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<title>Setup | Android Developers</title>
|
||||
|
||||
<!-- STYLESHEETS -->
|
||||
<link rel="stylesheet"
|
||||
href="//fonts.googleapis.com/css?family=Roboto+Condensed">
|
||||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
|
||||
title="roboto">
|
||||
<link href="/assets/css/default.css?v=5" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="//www.google.com/jsapi" type="text/javascript"></script>
|
||||
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var toRoot = "/";
|
||||
var metaTags = [];
|
||||
var devsite = false;
|
||||
</script>
|
||||
<script src="/assets/js/docs.js?v=3" type="text/javascript"></script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-5831155-1', 'android.com');
|
||||
ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
|
||||
ga('send', 'pageview');
|
||||
ga('universal.send', 'pageview'); // Send page view for new tracker.
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="gc-documentation develop guide" itemscope itemtype="http://schema.org/Article">
|
||||
|
||||
<a name="top"></a>
|
||||
|
||||
<!-- dialog to prompt lang pref change when loaded from hardcoded URL
|
||||
<div id="langMessage" style="display:none">
|
||||
<div>
|
||||
<div class="lang en">
|
||||
<p>You requested a page in English, would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<div class="lang es">
|
||||
<p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<div class="lang ja">
|
||||
<p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<div class="lang ko">
|
||||
<p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<div class="lang ru">
|
||||
<p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<div class="lang zh-cn">
|
||||
<p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<div class="lang zh-tw">
|
||||
<p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p>
|
||||
</div>
|
||||
<a href="#" class="button yes" onclick="return false;">
|
||||
<span class="lang en">Yes</span>
|
||||
<span class="lang es">Sí</span>
|
||||
<span class="lang ja">Yes</span>
|
||||
<span class="lang ko">Yes</span>
|
||||
<span class="lang ru">Yes</span>
|
||||
<span class="lang zh-cn">是的</span>
|
||||
<span class="lang zh-tw">没有</span>
|
||||
</a>
|
||||
<a href="#" class="button" onclick="$('#langMessage').hide();return false;">
|
||||
<span class="lang en">No</span>
|
||||
<span class="lang es">No</span>
|
||||
<span class="lang ja">No</span>
|
||||
<span class="lang ko">No</span>
|
||||
<span class="lang ru">No</span>
|
||||
<span class="lang zh-cn">没有</span>
|
||||
<span class="lang zh-tw">没有</span>
|
||||
</a>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<!-- Header -->
|
||||
<div id="header-wrapper">
|
||||
<div id="header">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="wrap" id="header-wrap">
|
||||
<div class="col-3 logo">
|
||||
<a href="/index.html">
|
||||
<img src="/assets/images/dac_logo.png"
|
||||
srcset="/assets/images/dac_logo@2x.png 2x"
|
||||
width="123" height="25" alt="Android Developers" />
|
||||
</a>
|
||||
<div class="btn-quicknav" id="btn-quicknav">
|
||||
<a href="#" class="arrow-inactive">Quicknav</a>
|
||||
<a href="#" class="arrow-active">Quicknav</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><!-- end header-wrap.wrap -->
|
||||
</div><!-- end header -->
|
||||
|
||||
|
||||
<!-- Secondary x-nav -->
|
||||
<div id="nav-x">
|
||||
<div class="wrap" style="position:relative;z-index:1">
|
||||
|
||||
<ul class="nav-x col-9 develop" style="width:100%">
|
||||
<li class="guide"><a href="/ndk/guides/index.html">
|
||||
Guides</a></li>
|
||||
<li class="reference"><a href="/ndk/reference/index.html">
|
||||
Reference</a></li>
|
||||
<li class="samples"><a href="/ndk/samples/index.html">
|
||||
Samples</a></li>
|
||||
<li class="downloads"><a href="/ndk/downloads/index.html">
|
||||
Downloads</a></li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="searchResults" class="wrap" style="display:none;">
|
||||
<h2 id="searchTitle">Results</h2>
|
||||
<div id="leftSearchControl" class="search-control">Loading...</div>
|
||||
</div>
|
||||
</div> <!--end header-wrapper -->
|
||||
|
||||
<div id="sticky-header">
|
||||
<div>
|
||||
<a class="logo" href="#top"></a>
|
||||
<a class="top" href="#top"></a>
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li class="current">Setup</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="wrap clearfix" id="body-content">
|
||||
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
<div id="devdoc-nav" class="scroll-pane">
|
||||
|
||||
|
||||
|
||||
<ul id="nav">
|
||||
<li><strong>NDK</strong>
|
||||
<ul>
|
||||
<li><a href="/ndk/guides/index.html"><span class="en">Getting Started</span></a>
|
||||
<ul>
|
||||
<li><a href="setup.html">Setup</a></li>
|
||||
<li><a href="concepts.html">Concepts</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/build.html"><span class="en">Building</span></a>
|
||||
<ul>
|
||||
<li><a href="">ndk-build</a></li>
|
||||
<li><a href="">Android.mk</a></li>
|
||||
<li><a href="">Application.mk</a></li>
|
||||
<li><a href="">Standalone Toolchain</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/debug.html"><span class="en">Debugging</span></a>
|
||||
<ul>
|
||||
<li><a href="">ndk-gdb</a></li>
|
||||
<li><a href="">ndk-stack</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/arch.html"><span class="en">Architectures and CPUs</span></a>
|
||||
<ul>
|
||||
<li><a href="">ABI Management</a></li>
|
||||
<li><a href="">Neon</a></li>
|
||||
<li><a href="">Mips</a></li>
|
||||
<li><a href="">x86</a></li>
|
||||
<li><a href="">x86-64</a></li>
|
||||
<li><a href="">CPU Features</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/libs.html"><span class="en">Libraries</span></a>
|
||||
<ul>
|
||||
<li><a href="">Stable APIs</a></li>
|
||||
<li><a href="">C++ Support</a></li>
|
||||
<li><a href="">Prebuilt Libraries</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/sample.html"><span class="en">Sample Walkthrough</span></a>
|
||||
<ul>
|
||||
<li><a href="">hello-jni</a></li>
|
||||
<li><a href="">native-activity</a></li>
|
||||
<li><a href="">Teapot</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/atomics.html"><span class="en">Atomics</span></a></li>
|
||||
<li><a href="/ndk/guides/importing.html"><span class="en">Importing Modules</span></a></li>
|
||||
<li><a href="/ndk/guides/depends.html"><span class="en">ndk-depends</span></a></li>
|
||||
<li><a href="/ndk/guides/system.html"><span class="en">System Image Issues</span></a></li>
|
||||
<li><a href="/ndk/guides/licenses.html"><span class="en">Licenses</span></a></li>
|
||||
</ul></li>
|
||||
<li><strong>Radiance</strong>
|
||||
<ul>
|
||||
<li><a href="/ndk/guides/null.html"><span class="en">Stub 1</span></a>
|
||||
<ul>
|
||||
<li><a href="">Stublet</a></li>
|
||||
<li><a href="">Stublet</a></li>
|
||||
</ul></li>
|
||||
<li><a href="/ndk/guides/null.html"><span class="en">Stub 2, etc.</span></a>
|
||||
<ul>
|
||||
<li><a href="">Another Stublet</a></li>
|
||||
<li><a href="">Another Stublet</a></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
buildToggleLists();
|
||||
changeNavLang(getLangPref());
|
||||
//-->
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div> <!-- end side-nav -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
scrollIntoView("devdoc-nav");
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-12" id="doc-col" >
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 itemprop="name" >Setup</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="jd-content">
|
||||
|
||||
|
||||
<div class="jd-descr" itemprop="articleBody">
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
<h2>On this page</h2>
|
||||
|
||||
<ol>
|
||||
<li><a href="#install">Installation</a></li>
|
||||
<li><a href="#configure">Configuring Eclipse</a></li>
|
||||
<li><a href="#verify">Verification</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This document explains how to:</p>
|
||||
<ul>
|
||||
<li><a href="#install">Get</a> and install the NDK.</li>
|
||||
<li><a href="#configure">Configure</a> your system and the Eclipse and the Android Development Tool
|
||||
(ADT) for use with it.</li>
|
||||
<li><a href="#verify">Verify</a>, using a simple sample, that everything is working as expected.
|
||||
</li>
|
||||
</ul>
|
||||
<p>This document assumes that you are already familiar with Java-based Android development. For more
|
||||
information on that topic, see the
|
||||
<a href="/">Android developer site</a>.</p>
|
||||
|
||||
<h2 id="install">Installation</h2>
|
||||
<p>To install and configure the NDK, follow these steps:</p>
|
||||
<ol type="1">
|
||||
<li>Get and install the <a href="/sdk/index.html">Android SDK</a>.if you
|
||||
have not already done so.</li>
|
||||
<li><a href="/tools/sdk/ndk/index.html">Download</a> and unzip the NDK,
|
||||
making sure to download the correct version for your development platform. You may place the
|
||||
unzipped directory anywhere on your local drive.</li>
|
||||
<li>Update your <code>PATH</code> environment variable with the location of the directory that
|
||||
contains the NDK.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<h2 id="configure">Configuring Eclipse</h2>
|
||||
<p>Eclipse must know where the NDK is in order to use it when building your app. Follow these steps
|
||||
to set the location of the NDK.</p>
|
||||
<ol type="1">
|
||||
<li>Launch Eclipse, which is installed as part of the Android SDK.</li>
|
||||
<li>Open <b>Window</b> > <b>Preferences</b>.</li>
|
||||
<li>In the pane on the left side of the <i>Preferences</i> window, select <i>Android</i>.
|
||||
The <i>Android</i> section expands, revealing a number of subsections.</li>
|
||||
<li>Select <b>NDK</b>. In the pane on the right side of the <i>Preferences</i> window, browse to
|
||||
the directory that contains the NDK.</li>
|
||||
<li>Click <b>OK</b> to return to the <i>Package Explorer</i> display.</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="verify">Verification</h2>
|
||||
<h3>Eclipse</h3>
|
||||
<p>To confirm that you have installed the NDK, set it up correctly, and properly configured Eclipse,
|
||||
follow these steps:</p>
|
||||
<ol type="1">
|
||||
<li>Import the hello-jni sample from <code><ndk>/samples/</code>, as you would any other Android
|
||||
project.</li>
|
||||
<li>In the <i>Project Explorer</i> pane, right-click the project name (<i>HelloJni</i>). A
|
||||
context menu appears.</li>
|
||||
<li>From the context menu, select <b>Android Tools</b> > <b>Add Native Support</b>. The
|
||||
<i>Add Android Native Support</i> window appears.</li>
|
||||
<li>Accept the default library name (“hello-jni”), and click <b>Finish</b>.</li>
|
||||
<li>Build and execute the application.</li>
|
||||
</ol>
|
||||
<h3>Command line</h3>
|
||||
<p>Follow these steps to build from the command line:</p>
|
||||
<ol type="1">
|
||||
<li>Change to the root directory of your project.</li>
|
||||
<li>Execute ndk-build to build the native component of your app. do this by
|
||||
typing <code>ndk-build</code> at the command prompt.</li>
|
||||
<li>Build and install your project as you would a regular Android app written in Java. For more
|
||||
information, see
|
||||
<a href="/tools/building/index.html">Building and Running</a> and
|
||||
<a href="/tools/building/building-cmdline.html">Building and Running
|
||||
from the Command Line</a>.</li>
|
||||
</ol>
|
||||
|
||||
<p>If you have successfully installed and configured the NDK, the screen on your target device looks
|
||||
as shown in Figure 1.</p>
|
||||
|
||||
<img src="./images/verification_screen.png" srcset="./images/verification_screen@2x.png 2x" alt="Output: Hello from JNI!" id="figure2" />
|
||||
|
||||
<p class="img-caption">
|
||||
<strong>Figure 1.</strong> Target-device screen after successful launch.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content-footer layout-content-row"
|
||||
itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
|
||||
<div class="paging-links layout-content-col col-10">
|
||||
|
||||
</div>
|
||||
<div class="layout-content-col plus-container col-2" >
|
||||
|
||||
<div class="g-plusone" data-size="medium"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div> <!-- end jd-content -->
|
||||
|
||||
<div id="footer" class="wrap" >
|
||||
|
||||
|
||||
<div id="copyright">
|
||||
|
||||
Except as noted, this content is
|
||||
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
|
||||
Creative Commons Attribution 2.5</a>. For details and
|
||||
restrictions, see the <a href="/license.html">Content
|
||||
License</a>.
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footerlinks">
|
||||
|
||||
<p>
|
||||
<a href="/about/index.html">About Android</a> |
|
||||
<a href="/legal.html">Legal</a> |
|
||||
<a href="/support.html">Support</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div> <!-- end footer -->
|
||||
</div><!-- end doc-content -->
|
||||
|
||||
</div> <!-- end body-content -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="https://developer.android.com/ytblogger_lists_unified.js" type="text/javascript"></script>
|
||||
<script src="/jd_lists_unified.js?v=8" type="text/javascript"></script>
|
||||
<script src="/jd_extras.js?v=10" type="text/javascript"></script>
|
||||
<script src="/jd_collections.js?v=10" type="text/javascript"></script>
|
||||
<script src="/jd_tag_helpers.js?v=5" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
94
docs/html-ndk/ndk/guides/setup.jd
Normal file
94
docs/html-ndk/ndk/guides/setup.jd
Normal file
@@ -0,0 +1,94 @@
|
||||
page.title=Setup
|
||||
@jd:body
|
||||
|
||||
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
<h2>On this page</h2>
|
||||
|
||||
<ol>
|
||||
<li><a href="#install">Installation</a></li>
|
||||
<li><a href="#configure">Configuring Eclipse</a></li>
|
||||
<li><a href="#verify">Verification</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This document explains how to:</p>
|
||||
<ul>
|
||||
<li><a href="#install">Get</a> and install the NDK.</li>
|
||||
<li><a href="#configure">Configure</a> your system and the Eclipse and the Android Development Tool
|
||||
(ADT) for use with it.</li>
|
||||
<li><a href="#verify">Verify</a>, using a simple sample, that everything is working as expected.
|
||||
</li>
|
||||
</ul>
|
||||
<p>This document assumes that you are already familiar with Java-based Android development. For more
|
||||
information on that topic, see the
|
||||
<a href="{@docRoot}">Android developer site</a>.</p>
|
||||
|
||||
<h2 id="install">Installation</h2>
|
||||
<p>To install and configure the NDK, follow these steps:</p>
|
||||
<ol type="1">
|
||||
<li>Get and install the <a href="{@docRoot}sdk/index.html">Android SDK</a>.</li>
|
||||
<li><a href="{@docRoot}ndk/downloads/index.html">Download</a> and
|
||||
<a href="{@docRoot}ndk/downloads/index.html#extract">extract</a> the NDK,
|
||||
making sure to download the correct version for your development platform. You may place the
|
||||
unzipped directory anywhere on your local drive.</li>
|
||||
<li>Update your {@code PATH} environment variable with the location of the directory that
|
||||
contains the NDK.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<h2 id="configure">Configuring Eclipse</h2>
|
||||
<p>Eclipse must know where the NDK is in order to use it when building your app. Follow these steps
|
||||
to set the location of the NDK.</p>
|
||||
<ol type="1">
|
||||
<li>Launch Eclipse, which is installed as part of the Android SDK.</li>
|
||||
<li>Open <b>Window</b> > <b>Preferences</b>.</li>
|
||||
<li>In the pane on the left side of the <i>Preferences</i> window, select <i>Android</i>.
|
||||
The <i>Android</i> section expands, revealing a number of subsections.</li>
|
||||
<li>Select <b>NDK</b>. In the pane on the right side of the <i>Preferences</i> window, browse to
|
||||
the directory that contains the NDK.</li>
|
||||
<li>Click <b>OK</b> to return to the <i>Package Explorer</i> display.</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="verify">Verification</h2>
|
||||
<h3>Eclipse</h3>
|
||||
<p>To confirm that you have installed the NDK, set it up correctly, and properly configured Eclipse,
|
||||
follow these steps:</p>
|
||||
<ol type="1">
|
||||
<li>Import the hello-jni sample from {@code <ndk>/samples/}, as you would any other Android
|
||||
project.</li>
|
||||
<li>In the <i>Project Explorer</i> pane, right-click the project name (<i>HelloJni</i>). A
|
||||
context menu appears.</li>
|
||||
<li>From the context menu, select <b>Android Tools</b> > <b>Add Native Support</b>. The
|
||||
<i>Add Android Native Support</i> window appears.</li>
|
||||
<li>Accept the default library name (“hello-jni”), and click <b>Finish</b>.</li>
|
||||
<li>Build and execute the application.</li>
|
||||
</ol>
|
||||
<h3>Command line</h3>
|
||||
<p>Follow these steps to build from the command line:</p>
|
||||
<ol type="1">
|
||||
<li>Change to the root directory of your project.</li>
|
||||
<li>Execute ndk-build to build the native component of your app. do this by
|
||||
typing {@code ndk-build} at the command prompt.</li>
|
||||
<li>Build and install your project as you would a regular Android app written in Java. For more
|
||||
information, see
|
||||
<a href="{@docRoot}tools/building/index.html">Building and Running</a> and
|
||||
<a href="{@docRoot}tools/building/building-cmdline.html">Building and Running
|
||||
from the Command Line</a>.</li>
|
||||
</ol>
|
||||
|
||||
<p>If you have successfully installed and configured the NDK, the screen on your target device looks
|
||||
as shown in Figure 1.</p>
|
||||
|
||||
<img src="./images/verification_screen.png" srcset="./images/verification_screen@2x.png 2x"
|
||||
alt="Output: Hello from JNI!" id="figure1" />
|
||||
|
||||
<p class="img-caption">
|
||||
<strong>Figure 1.</strong> Target-device screen after successful launch.
|
||||
</p>
|
||||
@@ -58,7 +58,7 @@ under {@code $NDK/platforms/android-<level>/<abi>/usr/include}. When
|
||||
have a specific new group of headers and libraries for an Android API level, it means that
|
||||
an app targeting that level should use the most recently released NDK assets. For example,
|
||||
there was no new release of NDK headers or libraries for Android API levels 6 and 7. Therefore,
|
||||
when developing an app targeting Android API level 7, you would use the headers and libraries
|
||||
when developing an app targeting Android API level 7, you should use the headers and libraries
|
||||
located under {@code android-5/}.</p>
|
||||
|
||||
<p>Table 1 shows the correspondence between NDK-supported API levels and Android releases.</p>
|
||||
|
||||
@@ -29,7 +29,7 @@ compiling, linking, and low-level architecture. In addition, the techniques it d
|
||||
unnecessary for most use cases. In most cases, we recommend that you forego using a standalone
|
||||
toolchain, and instead stick to the NDK build system.</p>
|
||||
|
||||
<h2 id="syt">Selecting your Toolchain</h2>
|
||||
<h2 id="syt">Selecting Your Toolchain</h2>
|
||||
<p>Before anything else, you need to decide which processing architecture your standalone toolchain
|
||||
is going to target. Each architecture corresponds to a different toolchain name, as Table 1
|
||||
shows.</p>
|
||||
@@ -69,7 +69,7 @@ shows.</p>
|
||||
|
||||
|
||||
|
||||
<h2 id="sys">Selecting your Sysroot</h2>
|
||||
<h2 id="sys">Selecting Your Sysroot</h2>
|
||||
<p>The next thing you need to do is define your <i>sysroot</i> (A sysroot is a directory containing
|
||||
the system headers and libraries for your target). To define the sysroot, you must must know the
|
||||
Android API level you want to target for native support; available native APIs vary by Android API
|
||||
@@ -86,7 +86,7 @@ SYSROOT=$NDK/platforms/android-22/arch-arm
|
||||
</pre>
|
||||
|
||||
For more detail about the Android API levels and the respective native APIs they support, see
|
||||
<a href={docRoot}ndk/guides/stable_apis.html>Stable APIs</a>.
|
||||
<a href={@docRoot}ndk/guides/stable_apis.html>Android NDK Native APIs</a>.
|
||||
|
||||
<h2 id="itc">Invoking the Compiler</h2>
|
||||
|
||||
@@ -307,7 +307,7 @@ platforms.</p>
|
||||
</table>
|
||||
|
||||
For more information on specifying a 32- or 64-bit instruction host toolchain, see
|
||||
<a href="{@docRoot}/ndk/guides/ndk-build.html#6432">ndk-build</a>.
|
||||
<a href="{@docRoot}ndk/guides/ndk-build.html#6432">ndk-build</a>.
|
||||
|
||||
<p>You may specify {@code stl=stlport} to copy {@code libstlport} instead of the default
|
||||
{@code libgnustl}. If you do so, and you wish to link against the shared library, you must
|
||||
@@ -334,7 +334,7 @@ copy of a C++ STL library, with working exceptions and RTTI support.</p>
|
||||
|
||||
<p>For more options and details, use {@code --help}.</p>
|
||||
|
||||
<h2>Working with Clang</h2>
|
||||
<h2 id="wwc">Working with Clang</h2>
|
||||
<p>You can install Clang binaries in the standalone installation by using the
|
||||
{@code --llvm-version=<version>} option. {@code <version>} is a LLVM/Clang version
|
||||
number, such as {@code 3.4} or {@code 3.5}. For example:
|
||||
@@ -413,9 +413,9 @@ working properly:</p>
|
||||
section.</p>
|
||||
|
||||
|
||||
<h2>ABI Compatibility</h2>
|
||||
<h2 id="abi">ABI Compatibility</h2>
|
||||
<p>The machine code that the ARM toolchain generates should be compatible with the official Android
|
||||
<a href="{docRoot}/ndk/guides/cpu-arch-abis.html">armeabi ABI</a> by default.</p>
|
||||
{@code armeabi} <a href="{@docRoot}ndk/guides/abis.html">ABI</a> by default.</p>
|
||||
|
||||
<p>We recommend use of the {@code -mthumb} compiler flag to force the generation of 16-bit Thumb-1
|
||||
instructions (the default being 32-bit ARM instructions).</p>
|
||||
@@ -467,9 +467,9 @@ NEON functions.</p>
|
||||
|
||||
<p>You don't have to use any specific compiler flag when targeting the MIPS ABI.</p>
|
||||
|
||||
<p>To learn more about ABI support, see <a href="{@docRoot}/ndk/guides/x86.html">x86</a>.</p>
|
||||
<p>To learn more about ABI support, see <a href="{@docRoot}ndk/guides/x86.html">x86</a>.</p>
|
||||
|
||||
<h2>Warnings and Limitations</h2>
|
||||
<h2 id="war">Warnings and Limitations</h2>
|
||||
<h3>Windows support</h3>
|
||||
<p>The Windows binaries do not depend on Cygwin. This lack of dependency makes them faster. The
|
||||
cost, however, is that they do not understand Cygwin path specifications like
|
||||
|
||||
@@ -41,7 +41,7 @@ libraries that run on the CPU powering his or her device.</p>
|
||||
|
||||
<h2 id="st">Standalone Toolchain</h2>
|
||||
|
||||
<p>It is possible to use the 64-bit x86 toolchain in standalone mode with the NDK. For more
|
||||
<p>You can use the 64-bit x86 toolchain in standalone mode with the NDK. For more
|
||||
information about doing so, see <a href="{@docRoot}ndk/guides/standalone_toolchain.html">
|
||||
Standalone Toolchain</a>, under the "Advanced method" section.
|
||||
|
||||
@@ -49,4 +49,4 @@ Standalone Toolchain</a>, under the "Advanced method" section.
|
||||
<p>The NDK provides native versions of Android APIs for 64-bit x86 machine code starting from
|
||||
Android 5.0 (Android API level 21). If your project files target an older API level, but include
|
||||
{@code x86_64} as a targeted platform, the NDK build script automatically selects the right set of
|
||||
native platform headers and libraries for you.</p>
|
||||
native platform headers and libraries for you.</p>
|
||||
|
||||
@@ -28,7 +28,7 @@ APP_ABI := armeabi armeabi-v7a x86
|
||||
</pre
|
||||
|
||||
<p>For more information about defining the {@code APP_ABI} variable, see
|
||||
<a href="{docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a>.</p>
|
||||
<a href="{@docRoot}ndk/guides/application_mk.html">{@code Application.mk}</a>.</p>
|
||||
|
||||
<p>The build system places generated libraries into {@code $PROJECT/libs/x86/}, where
|
||||
{@code $PROJECT} represents your project's root directory, and embeds them in your APK under
|
||||
|
||||
@@ -13,7 +13,7 @@ footer.hide=1
|
||||
<div class="col-7of16 cdol-push-1of16">
|
||||
<h1 class="dac-hero-title">Android NDK</h1>
|
||||
<p class="dac-hero-description">
|
||||
The Android NDK is a toolset that lets you implement parts of your app using native code languages such as C and C++. For certain types of apps, this can help you reuse existing code libraries written in those languages.
|
||||
The Android NDK is a toolset that lets you implement parts of your app using native-code languages such as C and C++. For certain types of apps, this can help you reuse existing code libraries written in those languages.
|
||||
</p>
|
||||
|
||||
<a class="dac-hero-cta" href="/ndk/guides/index.html">
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
page.title=Reference
|
||||
page.title=API Reference
|
||||
@jd:body
|
||||
|
||||
<p>NDK reference docs
|
||||
<p>The API reference for the NDK currently comprises documentation for the base set of
|
||||
native headers that the NDK provides for Android. These headers, and their associated libraries,
|
||||
provide functionalities such as:</p>
|
||||
|
||||
<ul>
|
||||
<li>Using hardware sensors.</li>
|
||||
<li>Accessing storage.</li>
|
||||
<li>Handling user input.</li>
|
||||
</ul>
|
||||
24
docs/html-ndk/ndk/samples/downloads.jd
Normal file
24
docs/html-ndk/ndk/samples/downloads.jd
Normal file
@@ -0,0 +1,24 @@
|
||||
page.title=Samples: Downloads
|
||||
@jd:body
|
||||
|
||||
<style>
|
||||
|
||||
.landing-button {
|
||||
min-width: 155px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>From this page, you can download samples that provide a look at the NDK in action. A few of the
|
||||
topics covered are:</p>
|
||||
|
||||
<ul>
|
||||
<li>Managing your native app's activity lifecycle.</li>
|
||||
<li>Using native OpenGL on an Android device.</li>
|
||||
<li>Implementing native audio.</li>
|
||||
<li>Exporting modules.</li>
|
||||
</ul>
|
||||
|
||||
<p class="landing-button landing-secondary"><a href="{@docRoot}ndk/samples/samples_download.zip">Download the NDK Samples</a>
|
||||
</p>
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
page.title=Samples
|
||||
@jd:body
|
||||
|
||||
<p>NDK samples
|
||||
<p>Welcome to the NDK samples area. Here, you can
|
||||
<a href="{@docRoot}ndk/samples/downloads.html">download</a> a variety of sample apps to help
|
||||
deepen your understanding of how to use the NDK. There are also detailed
|
||||
<a href="{@docRoot}ndk/samples/walkthroughs.html">walkthroughs</a> of several
|
||||
of the apps, providing additional insight into key topics.</p>
|
||||
|
||||
<p>These samples are also contained in the NDK installation package. They reside in
|
||||
{@code $NDK/samples/}, where {@code $NDK} is the NDK installation root.</p>
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ page.title=Sample: hello-jni
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>This sample provides a bare-bones look at HelloJNI, a minimal
|
||||
<p>This sample guides you through HelloJNI, a minimal
|
||||
application built with the NDK. This sample is in the {@code samples/hello-jni/} directory
|
||||
under the root directory of your NDK installation.</p>
|
||||
|
||||
@@ -120,4 +120,4 @@ that is, the string that the function on the Java side had requested.</p>
|
||||
<pre class="no-pretty-print">
|
||||
return (*env)->NewStringUTF(env, "Hello from JNI !
|
||||
Compiled with ABI " ABI ".");
|
||||
</pre>
|
||||
</pre>
|
||||
@@ -20,7 +20,7 @@ page.title=Sample: native-activity
|
||||
{@code samples/native-activity}. It is a very simple example of a purely native
|
||||
application, with no Java source code. In the absence of any Java source, the
|
||||
Java compiler still creates an executable stub for the virtual machine to run.
|
||||
The stub serves as a wrapper for the actual, native program, which lives in the {@code .so}
|
||||
The stub serves as a wrapper for the actual, native program, which is located in the {@code .so}
|
||||
file.</p>
|
||||
|
||||
<p>The app itself simply renders a color onto the entire screen, and
|
||||
@@ -256,4 +256,4 @@ program calls OpenGL to draw the screen.</p>
|
||||
engine_draw_frame(&engine);
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</pre>
|
||||
@@ -77,7 +77,7 @@ APP_STL := stlport_static
|
||||
{@code samples/Teapot/src/com/sample/teapot}, under the NDK installation root directory. It handles
|
||||
activity lifecycle events, and also enables the app to display text on the screen. The following
|
||||
block of code is most important from the perspective of the native-side implementation: The native
|
||||
code calls it to display a popup window for text display.</p>
|
||||
code calls it to display a popup window for displaying text.</p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
|
||||
@@ -357,4 +357,4 @@ activity is not yet ready.</p>
|
||||
state->userData = &g_engine;
|
||||
state->onAppCmd = Engine::HandleCmd;
|
||||
state->onInputEvent = Engine::HandleInput;
|
||||
</pre>
|
||||
</pre>
|
||||
BIN
docs/html-ndk/ndk/samples/samples_download.zip
Normal file
BIN
docs/html-ndk/ndk/samples/samples_download.zip
Normal file
Binary file not shown.
@@ -6,13 +6,23 @@
|
||||
localized titles are added in the language order specified below.
|
||||
?>
|
||||
|
||||
|
||||
<ul id="nav">
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>ndk/samples/downloads.html">
|
||||
<span class="en">Downloads</span></a></div>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header">
|
||||
<a href="<?cs var:toroot ?>ndk/samples/walkthroughs.html"><span class="en">
|
||||
Walkthroughs</span></a></div>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>ndk/samples/sample_hellojni.html">hello-jni</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/samples/sample_na.html">sample-na</a></li>
|
||||
<li><a href="<?cs var:toroot ?>ndk/samples/sample_teapot.html">Teapot</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header empty"><a href="/ndk/samples/index.html"><span class="en">
|
||||
Samples</span></a></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
10
docs/html-ndk/ndk/samples/walkthroughs.jd
Normal file
10
docs/html-ndk/ndk/samples/walkthroughs.jd
Normal file
@@ -0,0 +1,10 @@
|
||||
page.title=Samples: Walkthroughs
|
||||
@jd:body
|
||||
|
||||
<p>This section provides detailed walkthroughs of several key samples. The samples are as
|
||||
follows:</p>
|
||||
|
||||
<li><a href="{@docRoot}ndk/samples/sample_hellojni.html">hello-jni</a>: A very basic app that illustrates core workings of the NDK.</li>
|
||||
<li><a href="{@docRoot}ndk/samples/sample_na.html">native-activity</a>: An app that shows the fundamentals of constructing a purely native app. It places particular emphasis on the
|
||||
{@code android_native_app_glue library}.</li>
|
||||
<li><a href="<a href="{@docRoot}ndk/samples/sample_teapot.html">Teapot</a>: A simple OpenGL demo, showcasing the <code>ndk_helper</code> class.</li>
|
||||
Reference in New Issue
Block a user