Skip to main content

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

[block:views:article_lister_bespoke-block_13]

Jerry Hildenbrand
Jerry Hildenbrand

Jerry is an amateur woodworker and struggling shade tree mechanic. There's nothing he can't take apart, but many things he can't reassemble. You'll find him writing and speaking his loud opinion on Android Central and occasionally on Twitter.

17 Comments
  • I think I should have wiped the Dalvik cache in me brain before attempting to read that - thanks! I would like to know more ...
  • My guess for E What is e911?
  • 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?
  • 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.
  • loving these posts. As a new android user - they are really helpful.
  • Sadly,I understood all that. Of course, I develop mobile apps, so that helps...
  • LOL! Even sadder... I understood all of that and I DON'T develop mobile apps... but I do have a computer science background.
  • I understood all of that and I'm a Justin Bieber fan. :) I kid, I kid!!
  • 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
  • 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.
  • 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.
  • 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! :)
  • 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
  • as i know , QR Code is a matrix code (or two-dimensional bar code) created by Japanese corporation Denso-Wave in 1994. The "QR" is derived from "Quick Response", as the creator intended the code to allow its contents to be decoded at high speed. and i used java qr code generation
    http://www.keepautomation.com/products/java_barcode/barcodes/qrcode.html