Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Call Native Code From Your Android Applications

Call Native Code From Your Android Applications

This item in japanese

Responding to requests from developers, the Android Native Developer Kit (NDK) supports (with release 1 of NDK 1.5) calling native code in the Dalvik virtual machine. CPU-intensive operations that don't allocate much memory may benefit from increased performance and the ability to reuse existing code. Some example applications are signal processing, intensive physics simulations, and some kinds of data processing.

The NDK is a suite of tools that enable developers to create native code executables and shared libraries.

The initial release is targeted towards Java application developers who wish to write native code shared libraries. The primary benefits would be in accessing native code APIs and accelerating portions of their application.

One of the first applications to use the NDK was a breakout style game made by the developer Aki. He modified his applications to switch from JBox2Dto Box2D. The performance of JBox2D under the Dalvik JVM seemed to suffer due to an increased amount of garbage collection. Using the native Box2D libraries, the application performed well with only a slight drop in frames per second as the application reached its limit of on-screen objects.

While the initial offering of Android NDK only supports a subset of the full Linux and Android APIs, there are plans to increase functionality. Examples include adding support for linking with OpenGL ES and audio libraries which should enable high-performance games.

Rate this Article