Android NDK v4下载,2010年5月更新

作者: Android开发网原创 时间: 2010-06-04

  Android本地语言开发包NDK再次更新,本次Android NDK升级到了v4版本,提供了更多特性。目前最新版本兼容 Android 1.5或更高版本的固件,需要说明的是,在Windows平台上编译请使用Cygwin1.7版本,以及GNU Make 至少为3.81版 ,以免造成一些不必要的问题发生。

  Android NDK作为C/C++的本地开发包,目前支持以下主要库支持:

libc (C library) headers 标准C
libm (math library) headers  数学库
JNI interface headers  JNI接口
libz (Zlib compression) headers Zip压缩库
liblog (Android logging) header  Android日志库
OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers OpenGL ES 1.1及2.0
libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).  图形处理类,需要Android 2.2或更高版本固件支持
A Minimal set of headers for C++ support  一些C++辅助类

Android123提示大家需要注意的是使用一些库,比如OpenGL ES 2.0时需要在androidmanifest.xml中显示声明,比如<uses-feature android:glEsVersion="0x00020000" />  相关的声明方法可以查看androidmanifest.xml高级属性解析一文。

  有关OpenGL版本在Android固件上支持对应如下:

OpenGL ES 1.1 运行在Android 1.6 或更高,API Level 即 android:minSdkVersion至少为4
OpenGL ES 2.0 运行在Android 2.0 或更高,API Level 即 android:minSdkVersion至少为5 ,也是为什么一些3D的Live Wallpapers为什么必须在2.0以上固件才能使用,或者说为什么Home Screen改为Launcher2的因素。

 在NDK中,Google提供了很多实用的例子,在NDK的Samples文件夹中可以找到:

hello-jni — a simple application that loads a string from a native method implemented in a shared library and then displays it in the application UI.
two-libs — a simple application that loads a shared library dynamically and calls a native method provided by the library. In this case, the method is implemented in a static library imported by the shared library.

san-angeles — a simple application that renders 3D graphics through the native OpenGL ES APIs, while managing activity lifecycle with a GLSurfaceView object.

hello-gl2 — a simple application that renders a triangle using OpenGL ES 2.0 vertex and fragment shaders.

hello-neon — a simple application that shows how to use the cpufeatures library to check CPU capabilities at runtime, then use NEON intrinsics if supported by the CPU. Specifically, the application implements two versions of a tiny benchmark for a FIR filter loop, a C version and a NEON-optimized version for devices that support it.

bitmap-plasma — a simple application that demonstrates how to access the pixel buffers of Android Bitmap objects from native code, and uses this to generate an old-school "plasma" effect.

官方下载 http://dl.google.com/android/ndk/android-ndk-r4-windows.zip

 最后Android开发网提醒大家,NDK作为底层开发库很多依赖CPU架构,使用前请查看 NDK中的CPU-ARCH-ABIS.TXT文件,目前市面上的品牌Android手机均支持。