Thursday, February 21, 2008

Are you writing Java Apps for Android ? Maybe and Maybe not

Lot of people who are aware of Android think that they actually write mobile applications using Java. This is only partly correct.

What many people miss out is the fact Google Android uses ONLY Java Syntax. The java code that one develops for Android is converted in to standard Java bytecode. This again is converted in a different bytecode format (which Google claims that is an optimized, minimum memory footprint bytecode).

Basically, Android does not use a standard JVM (it uses a non-standard JVM called Dalvik) . The SDK also contains android.* packages apart from the usual java packages.

I found this post from Stefano Mazzocchi very interesting. He claims that the reason for Google using a non-standard JVM is not really for just optimization sake, but instead to get around any licensing issues with Sun for using J2ME. Wow! I never thought of that.

Its natural. If I were to run the Android project (instead of Andy Rubin), then I would start using J2ME as a preferred virtual machine for obvious reasons that we have a huge group of developers who can be readily moved/attracted to developing applications on Android. And then when it comes to licensing, I would think of someway to circumvent the problem and the one smart way is to make sure the final bytecode is not the same of the one generated by the standard java compiler. Thats exactly what Google engineers have done by developing Dalvik.


Other interesting links:
http://wireless.itworld.com/4269/071116googlesun/page_1.html
http://www.oreillynet.com/onjava/blog/2007/11/dalvik_googles_tweaked_nonstan.html

[Article imported from http://mohasinz.blogspot.com/2008/02/are-you-writing-java-apps-for-android.html]

No comments: