Tag Archive | "JIT"

Tags: , , , , ,

Running C++ Native Applications on Android, The Final Point

Posted on 22 November 2007 by Hatem Ben Yacoub

C++ programmingWith the launch of Android mobile platform, Google announced that developers can use Java as programming language to create applications for the platform and using Dalvik as the Java virtual machine. The choice of Java was itself a limitation for many developers, especially low level progammers used to deal directly with different mobile hardware issues…

It’s true that, for example, Symbian support programming in C++, but here is the full and real situation. There is a lot of application developed for Symbian, but you have to always compile your application for the different platforms separately. Applications for Symbian 3rd edition don’t run on 2nd, or 1st edition devices. Sometimes applications for S60 3rd edition are compatible with N73, but not with N80, while it should be the same operating system and there is no reason for an application to be hardware dependant.

Now back to Android, the fact is only Java language is supported doesn’t mean that you cannot develop applications in other languages. This have been proved by many developers, hackers and experts in application development for mobile. The guys at Elements Interactive B.V., the company behind Edgelib library, succeeded to run native C++ applications on the Android platform, even that at this time there is still many issues on display and sound … etc. This include the S-Tris2 game and a 3D animation demo of Edgelib.

Wouter ten Brink, Elements Interactive CTO, told us by email “As our company focuses on native (C++) development only, we will keep looking for solutions to bring native applications to Android.”. He added “Personally, I believe Google will eventually offer a way to run native code, but we’ll have to see what will happen on this area the coming months.”

Performance Vs Portability

It’s clear that Google, by making Dalvik the Java Virtual Machine for Android, is looking for maximum portability against performance. The MSM chipsets, currently supported by Android, include a Java hardware acceleration, which is supposed to provide high performance for Java applications running on Android Handsets. But it’s not everything.

The Google answer on running C/C++ applications on Android from the FAQs is : “No. Android applications are written using the Java programming language”. Very simple answer, but the problem here is for developers and companies having ready to use code and applications for other mobile platform and looking to get their code ported to Android at low cost.

Java-Not-In-Time and JIT

The performance issue in reality isn’t due to Java itself, but to the virtual machine running Java code on mobile devices. You can run Java very fastly on PCs today with JIT VMs, thing not available for mobile devices, which make Java applications and games very slow on mobile. So what about Dalvik ? Dan Morrill posted on the Android developers group that “a just-in-time compiler is definitely on the Dalvik roadmap”.

This should answer the performance question about Java, Android and Dalvik, even that we don’t know much at this time on the Dalvik VM.

Conclusion

Finally the choice of Java on Android is to make mobile application developement faster and easier for developers, and to make Android platform more stable. Probably many don’t agree on coding in Java for Android and looking for native support. This could solve some problems for native developers, but will open the door for a huge new problems and incompatibilities. If Google decided to make Android the best open mobile platform, it’s also their choice to keep this platform safe for a better future.

Comments (10)

Advertise Here
Advertise Here