Google Android code goes native
Dalvik VM hugs C, C++
Android developers can now slip native code into apps written for Android-based devices using Google's new native development kit (NDK).
The Android 1.5 NDK, which was announced Thursday on the Android developers blog, doesn't actually allow developers to run completely native code on devices. Instead, it supports adding native code into apps written to run in Dalvik virtual machine (DVM) instances.
Specifically, the NDK lets 'droid devs execute parts of DVM-bound apps using native-code languages such as C and C++.
But there are drawbacks to this method - so much so that the announcement warns developers that the NDK isn't for everybody. "As a developer," the announcement reads, "you will need to balance its benefits against its drawbacks, which are numerous!"
The announcement also details some of the pros and cons - actually, in their ordering, the cons and pros - of using the NDK:
Your application will be more complicated, have reduced compatibility, have no access to framework APIs, and be harder to debug. That said, some applications that have self-contained, CPU-intensive operations that don't allocate much memory may still benefit from increased performance and the ability to reuse existing code. Some examples are signal processing, intensive physics simulations, and some kinds of data processing.
The addition of the Android 1.5 NDK to the 'droider's arsenal indicates that the Android team is working to attract more developers to the platform - particularly Symbian developers, we would imagine, or possibly iPhone devs who have seen their hard work disappear into the horde of 50,000 apps now clogging the iTunes App Store.
If you're a developer with cojones of sufficient weight to wrestle with the obstacles outlined above, the Android team has set up a forum where you can swap notes with other native-code 'droiders. ®