Android Dictionary

What is Dalvik?  We hear that word getting thrown around a lot on the Internet when talking about Android and its inner workings.  While there's no easy explanation we can give in just a few paragraphs, we can cover the basics and point you in the right direction if you need to feed your nerdly side. In its simplest terms, Dalvik is a virtual machine that runs applications and code written in Java. A standard Java compiler turns source code (written as text files) into Bytecode, then compiled into a .dex file that the Dalvik VM can read and use. In essence, class files are converted into .dex files (much like a jar file if one were using the standard Java VM) and then read and executed by the Dalvik Virtual Machine. Duplicate data used in class files is included only once in the .dex output, which saves space and uses less overhead. The executable files can be modified again when you install an application to make things even more optimized for mobile. Things like byte order swapping and linking data structure and function libraries inline make the files smaller and run better on our devices. The Dalvik VM was written from square one with Android in mind.

Confused yet?  Don't feel bad, geeky programming talk usually has that effect. Think of it this way -- when you build a Java application for your computer, a Java Virtual Machine runs the compiled output of the source code. This is why Java runs on just about any operating system. Dalvik is a mobile-optimized version of a Java Virtual Machine, built with code from the Apache Harmony project, which is open-source and runs better than a standard Java VM would on our limited hardware, designed so that you can run more than one instance of the VM at a time -- ie multitasking.  Because Dalvik is open-source, it's also been ported to other operating systems, like the one on the BlackBerry PlayBook. It's pretty damn complicated, pretty damn cool, and Oracle (the company that bought Java from Sun) hates it.

Android uses Dalvik because while the license for the standard Java Virtual Machine is GPL2 (free and open-source), when placed in a mobile device and using the Java Micro Edition, it is not.  The big dispute between Google and Oracle is all based around Dalvik.  Google claims it was written in a "clean-room" environment without using any of Oracle's code, and Oracle disagrees.  We claim to have no idea, we're just glad it works as well as it does. 

For more on Dalvik, see the Google I/O website.

Previously on Android A to Z: What is CES?; Find more in The Android Dictionary

More from the Android Dictionary

Haptic feedback
Article
by Jerry Hildenbrand
Jun 05, 2012
We're back with another installment of Android A to Z, and this time we're looking at haptic feedback. It's one of those little things that can make a big difference, and something we ne...
Google Play
Article
by Jerry Hildenbrand
May 30, 2012
Today on Android A to Z we're going to talk about Google Play. If you're new to Android, you see us throw it around a lot when talking about downloading apps, but there's a good bit more...
Factor Reset
Article
by Jerry Hildenbrand
May 29, 2012
A factory reset is the ultimate cleansing of your Android device. It's usually either a last resort to fix a problem, done before you sell it, or because you like to flash ROMs. When you perform...
End of life
Article
by Jerry Hildenbrand
May 25, 2012
End of life is a term none of us ever want to hear. We envision it means the death of our phone, and we should just throw it away and get a newer model. After all, it's at the end of its life, r...
DLNA
Article
by Jerry Hildenbrand
May 24, 2012
DLNA, or the Digital Living Network Alliance is an organization set up by Sony in 2003 that determines a universal set of rules and guidelines so devices can share digital media. The devices co...

 
There are 16 comments

icu says:

I think I should have wiped the Dalvik cache in me brain before attempting to read that - thanks! I would like to know more ...

HAAS599 says:

My guess for E

What is e911?

dongemus says:

Knowing more is as easy as developer.android.com

P.S. ANDROID CENTRAL... your login with facebook button is not working for me, always has in the past?

icu says:

But I like Jerry's articles because he writes with such great beard.
I just added some bits from developer.android.com to Read It Later - now let us see if I read it later.

RyMac04 says:

loving these posts. As a new android user - they are really helpful.

Xopher says:

Sadly,I understood all that. Of course, I develop mobile apps, so that helps...

Insp_Gadget says:

LOL! Even sadder... I understood all of that and I DON'T develop mobile apps... but I do have a computer science background.

mattsthe2 says:

I understood all of that and I'm a Justin Bieber fan.

:)

I kid, I kid!!

ggr says:

I understood all of that and I am not a developer or have a degree in computer science.

Who the hell is justin bieber?
...
just googled his name
...
...
ah ... a kid and a singer ...

:( I am too old to keep up with all these new singers ...

I once understand all of that... But then I took an arrow to the knee

adriankeith says:

awesome post. I change roms like I change clothes (almost every month) and I always see that it's recommended to wipe dalvik cache but I never knew what the hell it was. of course, it's saved me from a few boot loops so I know it works but great article, thanks for sharing for those of us who don't do any development or anything remotely close.

great read.

ggr says:

hmm .. u change clothes once a month? ugh!! yuck!!

yeah was thinking the same thing... hope they meant "clothes style" and not just "clothes" lol.

Synycalwon says:

Good thing Dalvik isn't like Java on the desktop or servers! Putting aside the security holes and subsequent threat landscape Java for computers brings, we have continual problems at work with it causing workstation issues or heap dumps on servers. Needless to say, many of us in the IT dept. despise Java, but for some reason the in house developers love it! Anyway, cool article. Thanks! :)

The_Martin says:

Jerry you constantly manage to explain the most geeky programming terms in language those of us who don't do any programming understand. I still recall your warning about rooting whenever I consider doing it and generally don't!

Dalvik - a small coastal town in north Iceland - seriously