What is Dalvik and dalvik-cache?

AndroidDalvik

Android Problem Overview


I know this may be a basic question in Android. But what is Dalvik and dalvik-cache?

Android Solutions


Solution 1 - Android

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.

good reference

Solution 2 - Android

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.

Solution 3 - Android

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.

Solution 4 - Android

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndroid KillerView Question on Stackoverflow
Solution 1 - AndroidJesusFrekeView Answer on Stackoverflow
Solution 2 - AndroidomermuhammedView Answer on Stackoverflow
Solution 3 - Androiduser5065310View Answer on Stackoverflow
Solution 4 - AndroidNosegearView Answer on Stackoverflow