Android 2.3 NDK 的新特性

鉴客 发布于 2011/09/19 22:36
阅读 576
收藏 0

This release of the NDK includes many new APIs, most of which are introduced to support the development of games and similar applications that make extensive use of native code. Using the APIs, developers have direct native access to events, audio, graphics and window management, assets, and storage. Developers can also implement the Android application lifecycle in native code with help from the new NativeActivity class. For detailed information describing the changes in this release, read the CHANGES.HTML document included in the downloaded NDK package.


General notes:


·           Adds support for native activities, which allows you to implement the Android application lifecycle in native code.


·           Adds native support for the following:


§  Input subsystem (such as the keyboard and touch screen)


§  Access to sensor data (accelerometer, compass, gyroscope, etc).


§  Event loop APIs to wait for things such as input and sensor events.


§  Window and surface subsystem


§  Audio APIs based on the OpenSL ES standard that support playback and recording as well as control over platform audio effects

基于OpenSL ES标准的音频API,支持平台音效的录音和回放控制

§  Access to assets packaged in an .apk file.


·           Includes a new toolchain (based on GCC 4.4.3), which generates better code, and can also now be used as a standalone cross-compiler, for people who want to build their stuff with ./configure && make. See docs/STANDALONE-TOOLCHAIN.html for the details. The binaries for GCC 4.4.0 are still provided, but the 4.2.1 binaries were removed.

包含了更利于代码生成的新的工具链(基于GCC 4.4.3),可以作为通过./configure和make方式生成代码的开发人员的标准交叉编译工具,在docs/STANDALONE-TOOLCHAIN.html文件中可以找到详细说明。GCC 4.4.0仍然存在,但4.2.1已经被移除。

·           Adds support for prebuilt static and shared libraries (docs/PREBUILTS.html) and module exports and imports to make sharing and reuse of third-party modules much easier (docs/IMPORT-MODULE.html explains why).


·           Provides a default C++ STL implementation (based on STLport) as a helper module. It can be used either as a static or shared library (details and usage examples are in sources/android/stlport/README). Prebuilt binaries for STLport (static or shared) and GNU libstdc++ (static only) are also provided if you choose to compile against those libraries instead of the default C++ STL implementation. C++ Exceptions and RTTI are not supported in the default STL implementation. For more information, see docs/CPLUSPLUS-SUPPORT.HTML.

作为辅助模块提供了默认的C++ STL的实现(基于STLport),可以被用于静态库或共享库(详细的使用示例参见sources/android/stlport/README),如果想要代替默认的C++ STL实现,可以编译STLport(静态库或共享库)和GNU libstdc++(只能是静态库)。C++异常和RTTI在默认的STL实现中还没被支持,更多信息可参见docs/CPLUSPLUS-SUPPORT.HTML文件

·           Includes improvements to the cpufeatures helper library that improves reporting of the CPU type (some devices previously reported ARMv7 CPU when the device really was an ARMv6). We recommend developers that use this library to rebuild their applications then upload to Market to benefit from the improvements.

包含了改进的cpufeatures辅助库以用于提供准确的CPU类型(很多使用ARMv6的设备以前被报成了ARMv7 CPU),提醒开发保山,使用这个库需要重新编译应用程序然后上传到应用商店。

·           Adds an EGL library that lets you create and manage OpenGL ES textures and services.

增加了EGL库用于创建和管理OpenGL ES纹理和服务

·           Adds new sample applications, native-plasma and native-activity, to demonstrate how to write a native activity.


·           Includes many bugfixes and other small improvements; see docs/CHANGES.html for a more detailed list of changes.