I know this may be a basic question in Android. But what is Dalvik and dalvik-cache?
4 Answers
Dalvik is the virtual machine that is used by Android. It is generally thought of as a Java virtual machine, although this is not precisely correct. It uses an object model that is identical to Java, and its memory model is also nearly equivalent. But the dalvik VM is a register based VM, as opposed to Java VMs, which are stack based.
Accordingly, it uses a completely different bytecode than Java. However, the Android SDK includes the dx tool to translate Java bytecode to dalvik bytecode, which is why you are able to write Android applications in Java.
When you say "dalvik-cache", I assume you mean the /data/dalvik-cache directory that can be found on typical Android devices. When you install an application on Android, it performs some modifications and optimizations on that application's dex file (the file that contains all the dalvik bytecode for the application). It then caches the resulting odex (optimized dex) file in the /data/dalvik-cache directory, so that it doesn't have to perform the optimization process every time it loads an application.

- 13,221
- 9
- 64
- 84

- 19,784
- 5
- 65
- 68
-
16What if I delete these Dalvik Cache? Will there be any effect except the app will take time to load as it needs to rebuild it's Dalvik Cache? – Swanand Jan 16 '12 at 12:58
-
17Correct. There is no effect, other than increasing the next load time, as it is rebuilt. – JesusFreke Jan 16 '12 at 23:21
-
As someone posted on another duplicate question, here is your gratuitous wiki link "The Dalvik cache is an essential part of your Android. You can read more about it here: http://en.wikipedia.org/wiki/Dalvik_%28software%29" – qneill May 17 '13 at 15:10
-
1Why does Android Lollipop (version 5) still have Dalvik cache now that the VM is ART ? Some people told me it's for compatibility, but I've noticed it takes a lot of space (around 900MB). – android developer Feb 18 '15 at 21:01
-
3Art compiles the dex file into native code. That compiled code is what is now stored in dalvik-cache, with art. – JesusFreke Feb 19 '15 at 00:23
-
Note: Deleting does broke, that apps does not start. But on device reboot dalvik-cache is restored and all works normal. This was on MTK device – Solata Dec 08 '16 at 13:21
Dalvik is the java based Virtual Machine that runs Android Apps on Android. Dalvik-cache is the cache area for Dalvik VM, it is created when the Dalvik VM optimizes your app for running.
You can look up more on the internet about the differences between Dalvik VM op-codes and a "normal" Java VM Op-codes if you want.

- 7,365
- 4
- 27
- 40
Dalvik Caches are nothing but the temporary compilation of application code being stored as executables. As these can be compiled dynamically from the original application code sitting outside the Dalvik Cache, you can clear the Dalvik Cache without any real penalty.

- 2,386
- 1
- 21
- 35

- 11
-
@AndroidKiller that would be bytecode or binary images, depending on the presence of Dalvik or ART. Not graphical images. – Neil Steiner Oct 01 '15 at 15:47
The Dalvik cache is no part of modern Android versions anymore; Android 4.4 KitKat was the last to make use of this construction. See https://en.wikipedia.org/wiki/Dalvik_(software) for more details.

- 11
- 3