Should the Dalvik cache on Android phones be cleared periodically?

  • Thread starter Thread starter Wrichik Basu
  • Start date Start date
  • Tags Tags
    Android Root
Click For Summary
SUMMARY

The discussion centers on the process of rooting a Samsung Galaxy On7 running Android 6.0.1 using Magisk and TWRP. The user successfully removed bloatware and cleared the Dalvik cache, resulting in a recovery of approximately 1GB of internal memory. Clearing the Dalvik cache is confirmed to optimize app performance by removing outdated dex files. The user emphasizes the importance of backing up the stock ROM and data before undertaking such modifications to avoid potential boot loops and data loss.

PREREQUISITES
  • Understanding of Android rooting concepts
  • Familiarity with Magisk and TWRP tools
  • Knowledge of ADB and fastboot commands
  • Basic understanding of Dalvik cache and dex files
NEXT STEPS
  • Research the process of using Magisk for systemless rooting
  • Learn how to effectively use TWRP for backups and restores
  • Explore the implications of clearing Dalvik cache on Android devices
  • Investigate the use of the Magisk module "App Systemizer" for app management
USEFUL FOR

Android enthusiasts, mobile developers, and users looking to optimize their device performance by removing bloatware and managing internal storage effectively.

Wrichik Basu
Science Advisor
Insights Author
Gold Member
Messages
2,180
Reaction score
2,690
Finally, after a lot of hesitation, I rooted my phone (Samsung Galaxy On7, Android 6.0.1) using Magisk systemless root. The main aim was to remove pre-installed useless software (often termed "bloatware").

I didn't want to flash Magisk using TWRP, because installing TWRP would remove the stock recovery, and I would never get it back. I tried rooting using the Magisk installer itself, but it failed. So I had to unwillingly install TWRP first (thereby losing the stock recovery). I tried doing that using ADB (actually fastboot), but it couldn't recognise the device in bootloader mode. So I downloaded Odin and flashed TWRP. Then I flashed the Magisk zip file.

After the flashing was over, I also cleared the Dalvik cache, not knowing that this was not necessary. When I rebooted the phone, it took a long time to boot. It was showing, "Optimizing apps". I thought I had cracked the phone up and it was a boot loop. But later I found that everything was fine. In addition, clearing of the Dalvik cache actually freed up the internal memory by about 1GB.

I read online that Dalvik cache is actually the optimized dex files that the dex compiler builds to ensure the smooth running of applications. Now, the last official update to this phone was back in April 2018. Is it possible that the phone retained the cache of all apps since then, including the ones I had uninstalled? It seems so, otherwise how could I recover about 1GB of memory simply by clearing the Dalvik cache?

If I am correct that clearing the Dalvik cache freed up space, does it make sense to clear the Dalvik cache periodically, say annually, so as to prevent misuse of the "precious" internal memory?
 
Computer science news on Phys.org
Wow! What a lot of work and trouble. I know that bloatware is annoying, but was it worth that much to get rid of it?
 
anorlunda said:
Wow! What a lot of work and trouble. I know that bloatware is annoying, but was it worth that much to get rid of it?
Actually, my phone was getting too slow to work with. I never had any games installed (except maybe when the phone was first bought, but that is a long time back). I specifically installed the apps which could be moved to SD card. Even then, every morning, I would see more and more of internal storage being used up. This became irritating. If I took the phone to a service centre, they would either do a factory reset or ask me to change the motherboard. The second one is quite costly.

I read online that if you root the phone, then you can remove these system apps easily. Although your reserved system space is still not available for user app installations, the phone still becomes a bit faster, at least people on StackOverflow commented so. (You can actually use the freed-up system reserved space if you want, using the Magisk module "App Systemizer". It converts user-installed apps to system apps, and those will stay even if you unroot your device). Basically, this was the motivation. In addition, I was always interested in stuff like these, so it was not much trouble, except that I was scared that I might brick the phone. Also, XDA Developers have published extensive guides to root a phone, and they are very helpful for beginners like me.
 
  • Like
Likes   Reactions: anorlunda
Update: The phone suddenly switched itself off, and is now in a bootloop.:cry::headbang:
 
Update #2: Amidst the tension of losing the phone, it came to my mind that if I can somehow get the stock ROM and flash it, the phone will come back. So I started searching the net frantically, and finally came across the stock ROM. Downloaded it (a 1GB file), flashed it with Odin (the phone was able to enter recovery and download mode).

And finally, I have my phone back! Phew!
 
General rule with computers:
Make a backup FIRST!
 
Tom.G said:
General rule with computers:
Make a backup FIRST!
I store all my data in SD Card, so I didn't lose any personal data. What I lost was a couple of screenshots in the phone memory. My contacts are in Google account, so no fear losing them.

What I should have backed up was the stock ROM. The version of stock ROM that I found online was an old one, and I had to download all the OTA updates. As soon as all the updates were downloaded, I installed TWRP and backed up the system and app data. It is a ~5GB file, and I shall keep it safely for the future.
 
  • Like
Likes   Reactions: Tom.G

Similar threads

  • · Replies 16 ·
Replies
16
Views
8K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K