Android using Java VM for apps — whatever!
I can’t be the only one who’s disappointed with Android using Java as its application layer environment, can I? I’d heard in advance they were doing this but kind of didn’t want to believe it. Sure, props to their team for deconstructing and redeveloping Java in a pared-down, supposedly extremely efficient environment they’re calling the “Dalvik Virtual Machine”, but Java as a technology is no less clunky and annoying today than it was before Android was announced. (You know what they say about lipstick and pigs…) And while it’s great Android’s got a lot more optimized frameworks than your average Java-capable device, a mobile multitasking Java VM app environment is never going to run as well as something coded native to the core OS; this is already visible in the video demo where some of the swipes, taps, and touch gestures present a far chunkier, less visually satisfying experience than the bar that’s been set by the iPhone / iPod touch. Yeah, I know, the software is early, but Google’s offering up $10m for developers to start working on Android apps, and before we get too entrenched in even MORE phones running Java I’m nominating the first significant Android app work be done on the redevelopment of a new, proper application layer.
Co-founder of


You are far from the only person disappointed in the phone using Java. Why they would choose a bloated system over something nice and compiled like C or C++ is beyond me. I would much rather see a nice lightweight application built in C/C++ over some bloated piece of java.
In my opinion the only really good thing in Java is server side apps. That way the developer can control the entire environment from start to finish. JSP can do some amazing stuff, but so can PHP and ASP.
Google suggested this page for “Dalvik VM”, but I can’t leave your ill-informed biases unchallenged. How is Java clunky and annoying? It runs architecture-independent bytecode (which can deliver portability for app developers) in a sandbox that avoids buffer overflows and other cracks (which makes me trust applications more). As you acknowledge, Android lets Java applications call into various native code frameworks (SDL, WebKit, OpenGL, etc.); only time and real developer feedback will tell if Google got the layering right.
I just installed Opera Mini on my phone and the latest Eclipse on my PC, two fine Java apps that are far from “clunky and annoying”.
skierpage, I’m not a developer — and I think you’re conflating accusations (wouldn’t I either be ill-informed OR biased?). Anyhow, it’s clunky and annoying because when you’re developing for a virtualized, platform independent app layer, you’re not directly taking advantage of your hardware and OS’s capabilities. Sandboxing mobile Linux apps without Java is feasible — desktop operating systems do it, and they don’t need 3rd party VMs to make it happen. Could everyone in the world run all their apps in Java VMs instead of dedicated Windows / Mac / Linux apps? Sure, but no one wants to, it’s not anywhere near as good an end user experience as you get when developers pick a platform (or platforms) and take full advantage of it when developing an app.
Opera Mini’s a great example. Sure, it’s a very decent Java app, but Opera for Symbian and Windows Mobile are both far better.
Ryan, every application on my wonderful BlackBerry Pearl is written in Java (at least, every custom app – Google Maps, Google Talk, Gmail, Opera Mini) and I think the BlackBerry Pearl / 83xx series are the only smartphones, along with the iPhone once its SDK gets out the door, that balance functionality and ease of use well.
As for Windows Mobile – sure you can write C++, but the applications I use every day are written in Java or the .NET Compact Framework, which is just as sandboxed. But Windows Mobile is terrible when compared to the BlackBerry or iPhone user experience.
Suffice to say – Java+, which is what this is since it goes beyond J2ME to enable OpenGL and all the other hardware features that are part of the Android reference design, is more than able to cut it on today’s high-powered mobile CPUs. If Android can just get out of the way, more like the BlackBerry OS (whose existence you don’t even contemplate) and less like WM6 (which I curse every day for hanging, not managing multitasking well, and forcing me to shut down and restart on a semi-weekly basis), then it will have a chance at success.
“I’m not a developer — and I think you’re conflating accusations (wouldn’t I either be ill-informed OR biased?). Anyhow, it’s clunky and annoying because when you’re developing for a virtualized, platform independent app layer, you’re not directly taking advantage of your hardware and OS’s capabilities.”
You are not a developer, yet you are complaining about developer level aspects of the product (what language and application framework it uses). Every language out there but assembly provides an abstraction to the underlying hardware, this is missed by a lot of people out there. An operation system itself is already a layer of abstraction. Arguing against abstraction in something like this is a bit confusing.
If you take a look at the android API, they provide access for most of what you need to develop an app on a mobile phone. There is no reason why any bits can not be exposed, so I’m at a loss seeing how an Android app will be unreasonable restricted from accessing the capabilities of the phone.
[...] feature Java and a native iChat/IM application. Does that mean that iPhone will be able to run Android? I wouldn’t hold my [...]
totally unrelated to this post but,
Great Cameo in today’s Mahalo Daily.
Wonderfull line. “mmmm”
you snatched that grilled cheese like a needy child.
Well, let’s say your bias is caused by you being ill-informed. As the other posters have said, every 3rd generation language abstracts the underlying bit parsing. If you’ve bothered to look at recent benchmarks, you’d know Java JIT performance is on par with C++ and occasionally approaches C. If you WERE a developer, you might understand just how much easier Java is to work with than most of the other languages you mention and how much more 3rd party open source support there is out there for it. As a business strategy, Google is very smart in leveraging a generally easy and egalitarian platform that taps into the GREATEST number of existing developers.
I think it would have been great if they supported the upcoming AIR mobile virtual machine.
This accelerate the handset life-cycle which to keep the hardware maker happy. A business strategy.
@ Taulpaul
If AIR runs anything on a mobile like good ol’ flash does on a mac, I strongly disagree.
I think we’re losing something important in this platform-independent craze… I’m not suggesting we go the way of the mac, but the hardware is so grossly different for all the mobile platforms out there that you can’t develop anything cross-platform without a slew of shenanigans.
I would liken this to the browser battle–i.e. how webkit/Safari/Mozilla-based browsers continue to support standards while Microsoft is quite happy telling everyone else to go kick rocks and f*** themselves while both the developers and users are made to suffer.
STANDARDS! PLEASE!
completely agree. as a developer, while i understand why java has been and will continue to be important, i personally hate it. again, while i understand the reasoning behind it, i’m surprised that google – what with their permanent stiffie [in a good way ;) ] for python – didn’t create a python-esque SDK… i know i would’ve preferred it.
If you want an SDK to code Apps, Java is fine. But for NATIVE core functionality (such as the UI shell, etc.) it would be awful. All things being equal, I challenge someone to find a JIT compiled app that runs as fast as its natively compiled and optimized counterpart.
When I think of Java, I think of write-once, slow everywhere. Don’t even get me started on the nuances of vendor support for the different VMs.
At the begining, Java was slow… it’s right, but it was the starting point.
Non, if you see slow application, memory consuming application (I read this, sometimes), you have a not well programmed application…
Are all C/C++ applications fast ? of course not! And it is the same thing for all languages.
The JVMs were slow, it’s true, but it’s not true now. It was similar with .NET
And I think that C/C++ application, 10 years ago, was more slowly than now… why? hardwares progress, OSes progress too…
And the most important, how can you say an application on an OS you don’t know and on a hardware you didn’t know too (and I don’t know it too) will be
slower in Java than in C/C++ ?
I’m don’t prefer Java or C/C++, I’m using two, but I’m fed up with all these useless discussions that are useless for everybody. I remembers me discussions about windows/linux best OS…
They choose an SDK based on Java for lots of reasons, only future will say if it is a good choice or not, if it has suffisent performances…
But they could choose a C/C++ SDK and have a very low success too…
So. It’s been a month since the phones were released. They work GREAT. The Java development environment is Freaking Awesome.
So you’re wrong. Proven. :)
Writing this from a pocket sized device (htc g1) with 100 megs ram…that is mostly consumed by apps that use no less than 10 megs RSS each, including the very simple and basic browser that is eating 30 megs ram. I’m pleased i was able to switch to the terminal and back (to get the mem info) without losing what Im writing, for android uses a VERY aggressive watchdog that slays apps constantly, to make room for the excessive memory requirements that are required by the ball and chain tha is java. I tried fennic recently and curse the gods of portability every day, as it won’t be ported to google’s semi-optimized, badly chosen platform. (13 megs RSS for an alarm clock?!)
native c/c++ apps are not THAT hard to port, especially seing as ARM is becoming standard for phones etc.
There seems to be a lot of Java craze going on, with Android jumping into the Java bandwagon and drinking the Java kool-aid.
The only real advantage of Java is that it’s a high level sand-boxed programming language. The idiot who once kept allocating memory and did not free it, the guy who kept having buffer overruns without realizing it, the guy who didn’t know how to properly allocate/deallocate a linked list is now a competent programmer thanks to Java. Java does all the nitty-gritty programming for you. You no longer need to understand how pointers work, you no longer need to understand program flow, you no longer need to worry about creating garbage out of the system’s memory because not only Java does all that for you, but it also ties your hands behind your back so you can’t fudge with it even if you wanted to. That’s awesome for idiot programmers who continually used their hands to fudge things up, but it really sucks for programmers who liked having control. It really really sucks more because Java reduces all programmers to the level of the idiot programmer, and wastes CPU cycles continually cleaning up after the idiot programmer (which is now everybody!)
Regardless of how you try to put it: running a program in an emulated virtual machine is not dignified, it’s slow and clunky, and leaves a lot to be desired.
Whoever thinks it’s “portable” and cross platform please bring me an Android app running on a different machine with a different OS without having to recompile anything. It’s no more “portable” than C. It’s no more portable than an NES program designed to run on a NES but can be run in any platform with the proper NES Emulators Java is no different of a concept.
At least with C the program is compiled into native binary that runs on the specific hardware without an emulator layer. Java’s emulator emulating native code out of Java code wastes way too many CPU cycles. I can see this very easily when I just modify my C program that ran very fast on a 33MHz 486SX, and it runs much slower on the G1 which supposedly has much faster hardware! The extra CPU cycles are spent translating Java code into native code during run time. What a waste. Whoever thinks Java isn’t slow and clunky doesn’t know anything about low level programming.
Luckily, Android NDK allows parts of the program to be written in C compiled into Native code. The code still has to interface with the main part of the program written in Java, but at least now you can write some native code for Android…. but good luck trying to install the NDK, there’s very little documentation on the NDK.
I agree, absolutely.
marco
And what about those apps written in C/C++, including games, that I can use on almost any linux box, even on ARM, just by running ./configure, make? People wrote these for decades, forcing java just destroys the legacy.
One of the worst things about Android using Java instead of C (the NDK notwithstanding) is that doing so closes off the possibility of using all the other programming languages that have been implemented in C, but not Java (usually because doing it in Java or on the JVM is tricky business, unless you’re satisfied with the most basic kind of interpreter). It’s impractical to write Android programs in: D, Perl, Scheme, Lua, and many others, all of which are better than Java. The only programming language that is PRACTICAL to use for writing Android programs is Java.
Java was a solution looking for a problem,
Java is a solution looking for a problem,
Java will always remain as a solution looking for a problem.
What earthly benefit do you get with the following layers?
OS as an abstraction on the hardware, then Java(the JVM) as another abstraction on the OS and finally “your” apps accessing the Java layer (if you call that as an abstraction). It’s like asking your “message” recipient to go check her voice mail to check her email to check whether she received the postal mail that was sent last week.
Java sheeps
from the so many new and better language
Google had to choose JAVA.
a slow, bloated, outdated, useless language out from the 90
Java and their apps should be in a museum
next to the Borland Turbo C/C++
Well at least you can use the old Borland C++
to teach kids programming
Some of you guys are talking about “abstractions” as though that’s the problem. It isn’t. There’s nothing wrong with abstractions. When used properly, they actually tend to make code better and faster, not slower and worse. The problem is that Java runs on an interpreter, which is essentially an emulated machine. Emulation, by its very nature, effectively guarantees a huge multiplication in execution time because every single operation has to trigger some conditional in a loop rather than just being executed by the processor.
Android is still good. Interpreted Java (like all interpreted languages) is awful, and you can feel the sluggishness it imparts to an Android device, but this sluggishness isn’t too bad on faster phones, and most apps aren’t time-critical. But that’s not the reason that Android is still good. Android 2.2 will have just-in-time compilation, which means Java bytecodes will be translated into native code. That should give a massive speed boost, but that’s still not the reason that Android is still good.
The reason that android is still good is that NATIVE code is supported. No other phones I know of allow this. Many Android apps (such as the Android SNES emulator I like to play) are written in native ARM assembly language using the Android NDK (look it up). True, Java is the main API, where most of the features live, but it’s not the only API Google has made available on the platform, and that seems like a key detail that this article fails to mention.
This article makes it sound like you have to write every function in your Android app in Java whether you want to or not, and that’s patently false.
For those of you, like me, who are web developers, working in scripts rather than compiled code, don’t fret… forget about archaic java, but rather use Titanium to program all of your Mac/PC/iPhone/iPad/Android and soon Blackberry apps in html/javascript/css/php/ruby, etc… it will compile out for you in the proper language, fully packaged and ready to sell. Bets part is, it is FREE.
Screw Java!
Just about everything said about Java above is misinformation. Modern Java is very close to C++ in performance, even beating some compilers (note the difference between language and VM/compiler) in some benchmarks. Search for benchmarks for Java6 and run some tests on your own. You will be convinced.
Java runs as native code. The compilation just happens to be done later (JIT). AOT compilers exist for Java, just like C++. Not worth while though.
Java 6 is much easier to use than Java from 90s. If that is not enough, use Scala. It works seamlessly on JVM, performs about the same as Java, has adequate tooling and is *highly* expressive, far exceeding C++. It works on Android. Java can be as simple or as complicated as you would want.
The only place where Java falls short to C++ in general use (not including very low level apps that need bit flipping) is in memory use. This has to do with the fact that it is a garbage collected language. For a garbage collected language, Java performs quite well.
I have developed in over 15 languages with Java and Objective-C being my current heavily used languages and have owned 2 software companies and still develop heavily. Have used C++ and even assembly for device drivers. Java is the most widely-used language/platform in the world and is often misunderstood because many people call it bloated in the mobile world but do not understand there are different optimized versions of Java for desktop, servers, mobile and more. It really annoys me when people who are not developers try to comment on developer specifics as Ryan did. You will never see me telling an expert Mercedes mechanic that this aspect of the engine is crap without my as least having a pretty strong knowledge level to be even to enter the conversation. If you don’t let the ask the experts questions but acting like you are knowledgeable of something you have no experience in in ludicrous,
Well and after all these years, it is clear that android is clunky jerky even on my experia arc with 1.2 ghz. I am too a developer, and remember times I programmed and compiled with WatCom, to get the last bit of performance of a game engine.
Now I own a company with a popular app, and the performance between iOS and android is a scandal. The slower 3GS is smoother than an xperia arc. How come?
Android is mature now, and it is obvious that it was a bad choice.
Making the life easier for developers, but badder for the user.
The only one too blame is the jvm, no matter java sheepskin like to twist and turn it.
I am seriously disappointed about the evolution of things, with a 486 dx4 you could more amazings things than with android now. A simple app with 2 forms scroll jerky but at least they consume 3 mega of ram. Great
I agree with Iona ma.
People likes to think Java performs as good as C. But the fact is, that even C compilers are still not as good given the many new processor specific instructions not being used efficiently. So, how can that VM possibly be as good?
And some of you ranting about layers of layers bla.. sure, but in C or C++ you have the freedom to use the Assembly language, and processor specific codes as needed. That will give us the edge.
See this guys post if you don’t believe me http://www.shervinemami.info/armAssembly.html
Also, i’m about to enter the Android market as a developer. Best thing i could do is using QT (Necessitas).
For those saying Java is as fast as C++ or C give me just one, just one application written in Java that is as fast or even faster than their counterpart. What good is line by line comparison. People use application and not loops or any other benchmark test.
I don’t like the iPhone, but compare the Applications there against any one developed for Android.
One good example is this app for musician that being co-developed by Jordan Rudess http://samplewiz.com/
It was developed for the iPhone and iPad, but they are also painfully try to release an Android version, check their FAQ. http://samplewiz.com/faq.html
Oh, and some of the QT sample game applications ran very smoothly on top of Android, even if they only used software rendering. Pretty impressive don’t you think?
From the Android NDK site:
“The Android NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code.”
What does that tell us?
Now, i have nothing against Java. As i am a java developer myself. I just don’t like people blindly believing in Java is any better than other languages. It has some uses like anything else.
Java worshipers, that’s where i have issues with. I can’t stand them.
I think Google chooses Java because the influx of Java developers out there, simplicity, and rapid development. All that to counter the climbing number of iOS developers. But doing so at the cost of alienating non java developers.
Same thing happens to the Windows Phone 7 now, with their lack of support for native code.
The very source of the problem is Sun Microsystems, they define and went after whomever broke off VM and go the machine-code route instead of bytecode. The language is streamlined version of C/C++ when you look at it superficially. As a general purpose language Java is very good indeed with overzealous parent that gave rise to C#.
When is last time you do unions, bitwise variables, destructors, multiple inheritance? And the crown-jewel is Garbage Collector, a phone cannot just go about rebooting in the middle of the day just because some guy forgot to dealloc() or delete heap. Now JIT, it did offer good speed; the only problem I can see is that VNC needs Native not Dalvik. Sun Micro did not say ‘OK, we need a carbon copy of Visual Basic with a more popular syntax’, they had to design entire VM to compete and wreck their hardware line up.
You should be properly armed with information before you bash it for being no good it sounded no more like OS war or browser war redux. Just GC along renders the original article quite meaningless. You can say to adopt Microsoft’s early ’90s approach of Runtime but back to unmanaged approach of C/C++ is very bad idea.
LOL, gotta love Java-hating snobs. It’s so 2002. Oh man, Java is slow, real men program in C/C++ (which is fast for machines, but slow and painfully error-prone for humans to actually create, compile, and maintain). Either that or “Java is lame, real men program in Python” (which is actually quite a bit slower than Java but hey, it’s hip).