• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Dalvik cache?

The dalvik cache is where the android system stores the compiled Java class files(basically the internal workings of an app) also know as .dex files. Whenever you update an app, the os moves the classes.dex file of the updated app into the dalvik cache to ensure the dalvik Vm(the android Java virtual machine) will be using g the right classes for the right app.

When flashing mods that alter a .dex file for an app such as a theme that makes changes to one of the framework .dex files then its best to clear the dalvik cache to ensure the android system rebuilds the cache with the right .dex files

On the contrary to what 99% of people say, flashing kernels or mods that do not replace apps does not require clearing the dalvik cache. The kernel has nothing to do with the dalvik cache. Its the dalvik Vm and android os that uses it. You can argue all you want but you don't have to clear it if what you flashed doesn't change or replace apps.

Having said that, clearing the dalvik cache wont cause any harm except for a long boot time on the next boot while the os rebuilds the cache.

Now it may be possible that dex files have become corrupted due to errors in I/o functions and clearing the cache would help. But I'm sure this does not happen often at all especially on journeled file systems which our phone uses.

So to a swerve your question, its not crucial to do it
And it wont free up any space because even when you uninstall an app, it's dex file gets removed. Now if you manually delete apps( like with root explorer) it may be wise to clear it as those dex files wont be removed, although they should be removed on the next boot.

However sometimes I clear mine to ensure the dalvik Vm is reading for correct and up to date dex files for the app. But its not like an every week or even every month kind of thing to do. But it certianly wont hurt to do it.

I just hate when people say to clear the dalvik cache for every little thing, like flashing a mod that copies over an init.d script and they say to clear the dalvik cache. Its not needed in those cases!!

Hope this helps out!
 
Upvote 0
I just hate when people say to clear the dalvik cache for every little thing, like flashing a mod that copies over an init.d script and they say to clear the dalvik cache. Its not needed in those cases!

I think I may have suggested wiping the Dalvik Cache if anyone had problems with the Init script I put together but honestly the only thing I noticed that made me think it could help is that before using the script I had used either Auto-Killer or another similar App for adjusting minfree values and on a few occasions when using the option in the App for returning these values to the default settings it would return to minfree values before the script but when I would wipe caches and then use the Apps return to default settings option it would use the values set on the script. In short it seemed that without wiping caches when restoring defaults it restored the values that had been set when the App was installed and not those set by the script. Based on this I figured there could be other little things going on along the same lines. Otherwise I’m not going to pretend I understand exactly how the Dalvik Cache works and it could just be something else entirely unassociated with the Dalvik Cache or if only wiping the cache or the Apps data would have sufficed but figured I would give an explanation of why I thought wiping the Dalvik after using the script could not hurt. Another reason is because I took a bunch of stuff from other scripts whose authors had also suggested wiping the Dalvik so thought it may not be a bad idea on suggesting the same.
 
Upvote 0
Yeah well ideally Modding shouldn't affect the dalvik cache. But as with alot of electronic items, sometimes you can't explain their behavior sometimes. If things start bugging out I usually try wiping the dalvik cache to eliminate any potontial dex file corruption. But sometimes these phone will do things that defy logic lol!

Which is probably why most people say to just wipe it when flashing something. Just to be 100% sure that it won't be an issue.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones