# Flash dalvik cache before/after?



## throwbot (Jan 2, 2012)

Okay, so I know a ton of people say that you wipe dalvik before you flash stuff. I usually never wiped anything, not even cache partition, unless I was starting all over and doing a full wipe and never really had any problems.

When I ran the v6 script/supercharger, it said that it needed to wipe dalvik cache at the very end (super clean) if I didn't want to have any problems. It made me remember seeing somebody somewhere else say that dalvik should be wiped after a flash. And then I started using twrp open recovery. With it, after you flash anything it gives you the option to wipe dalvik.

So, does anyone know what wiping dalvik actually does? Is it better to flash before or after? Super nerds, please chime in.

Sent from my Galaxy Nexus


----------



## Joesyr (Feb 7, 2012)

The Dalvik Virtual Machine is part of android, you can google it if you want to know more. Put simply, the Dalvik cache is created so the system has access to information it needs from all the various apks on your phone. It is created at boot so that it doesn't need to go and retrieve necessary info anytime something needs to be done. Normally these files are in archives and scattered about, so building the cache lets everything run efficiently and smoothly.

Clearing it is done so that it can be rebuilt from the source files. If you install something that changes the way an app or part of the framework runs, the cache may now contain outdated instructions for how to run that code, leading to instability.

Because building it is a process that happens when your OS boots up, it doesn't really matter if you do it before or after flashing something when you're in recovery mode.

You almost definitely want to wipe it any time you flash a new rom, theme, or mod that interacts with programs that run within android. So, pretty much anything except for kernels.


----------



## Helltoupee (Jun 12, 2011)

The way I understand it and correct me if I'm wrong is this.

Think of Android as 3 parts. The Linux kernel, Dalvik machine and Java.

The Linux kernel is well the Linux kernel that controls all the processes. Java is Java and the language that Android apps and games run in. Then think of Dalvik as the Microsoft equivalent of Java runtime. Dalvik acts as an intermediary between the kernel and the Java apps running in Android.

I'm sure it's much more complex than that but that is my basic understanding. If this is correct I hope it helps.

Sent from my Galaxy Nexus using Tapatalk 2


----------



## throwbot (Jan 2, 2012)

OK, sweet thanks for the replies. Yeah, I know a kernel has to do with the interaction between hardware and software, but I am new to all of this (compared to some people) so I really have no idea what in the hell is going on.

And that makes sense about building the cache for changed apks, I mean I'll take your word for it that it doesn't matter if you do it before or after a flash. I'll keep doing it the way I've been doing it BC everything seems to work fine, I just wanted a better understanding of what I was doing. Started reading some stuff from another forum and it seemed mostly like a bunch of wild guesses as to what was going on.

Sent from my Galaxy Nexus


----------

