android logo install upgrade rom

Android users who tried to patch a new version of Android, confronted with Dalvik Cache, developers as well confronted with Dalvik in process of developing apps.

In a short row I can tell you that Dalvik and Dalvik Cache are two different things. To understand, Dalvik (without Cache) is a Virtual Machine based on Java which runs Android Apps on Android. Dalvik-Cache is the Cache Area of the Davik Virtual Machine and it is created when Dalvik Virtual Machine optimizes your app to run.

Dalvik Explained

Dalvik is the virtual machine running on Android and is used by Android to run apps. In general it is a Java Virtual Machine. Dalvik uses an object model that is identical to java and also it uses almost the identical memory model.  Everyone know Dalvik as Virtual Machine because that it is how it is supposed to work and that is how it is registerd.

What we know is that Dalvik uses a different byte code than java, however we don’t understand the reason, probably to look different from Java, because Android SDK includes a specific DX tool that is used to translate Java byte code to Dalvik byte code. That is a plus for developers which write apps in Java and apps are automatically translated to Dalvik byte code.

Dalvik Cache Explained

Dalvik Cache, a component that Android ROM modders always ask you to clean before patching your Android with a custom ROM. Well, when you say Dalvik-Cache, probably you mean the following directory: /data/dalvik-cache which can be found on any of the Android devices.

So, how it works? When you are intalling an Android application on your Android device, it will automatically perform necessary modifications and optimizations on the application’s DEX File ( the file that contains all the Dalvik byte code of the application ). After that it will cache the result, the result will be the optimized version of DEX file, this time called ODEX file which will be stored in the /data/dalvik-cache directory. This optimization will be done only first time when the application runs, the second time when the application will run there will be no need to do the optimization process every time the application starts. See bellow how it works.

Dalvik CacheI think that now you understand exactly what is Dalvik Cache and that there is a big difference between Dalvik Virtual Machine that runs applications on Android, and the Dalvik-Cache file that is used for the application optimization one time process.

2 COMMENTS

  1. […] Before starting with wiping Dalvik Cache, we should understand Dalvik and Dalvik Cache. By understanding these two, I mean that Dalvik and Dalvik Cache are two different things with different meanings. Dalvik (without Cache) is a Virtual Machine which actually runs your Android Apps on your Android Device. Dalvik-Cache is the Cache Area of the Davik Virtual Machine and it is created when Dalvik Virtual Machine optimizes your app to run. Read More Here to Understand Dalvik and Dalvik Cache. […]

Leave a Reply