How do I clear caches (app, individual apps, Dalvik, ART if possible) via ADB?

Using apps, recovery, or doing it through Settings are not options for me. Also, my phone is not rooted.

  • Relevant answer on Stack Overflow. – Firelord May 26 '15 at 21:38
  • Do you want to only clear cache, or cache+data would also do fine? I think this is your original question and you posted a trimmed version here. – Firelord May 26 '15 at 21:46
  • Thanks very much for your response. I'm actually hoping to only clear caches, but keep data. It appears that wiping the Dalvik cache isn't possible here without rooting. I have yet to find anyone anywhere who talks about wiping the ART cache in any way. (I posted a new question that was more specific and less dense since the other appeared to scare people away. Yeah, bad, I suppose, but this question is technically more specific and therefore different.) – LakeHMM May 26 '15 at 21:56

ADB is close, but things like adb shell pm clear <package_name> to clear caches (and data, oops) from selected apps requires root (as would clearing Dalvik cache). But there's a similar approach to just wipe out all app caches (not Dalvik/ART, though): fastboot erase cache would do that with the device booted into the bootloader. Details can be found e.g. here: Useful ADB and Fastboot Commands and How to Use them.

  • Looks promising! I'm still unclear as to how to do it though. adb reboot bootloader and adb reboot fastboot both appear to just reboot the phone normally. I don't know what they're supposed to do, but it looks like a regular reboot and brings me into the regular UI. And afterwards, fastboot devices lists nothing, even though adb devices does. I tried fastboot erase cache, but it just says < waiting for device > forever. What exactly do I have to do in order to be able to execute fastboot erase cache? – LakeHMM May 27 '15 at 0:09
  • 1
    If you see an UI, it definitely was not fastboot/bootloader mode. Bootloader is the lowest level you can boot into, a very basic OS so to speak. You can check with our fastboot tag-wiki, and search its questions for your device, to figure out how to get it into that mode. If you can't figure, be welcome asking a new question on that. And yes, fastboot devices will only report your device in fastboot mode – where adb devices won't report anything. – Izzy May 27 '15 at 6:03
  • So there's no way to ONLY clear cache? @Izzy – Shayan Dec 31 '18 at 0:00
  • @Shayan not that I know of – except on rooted devices (see Seo's answer for that). – Izzy Dec 31 '18 at 7:22

If you have root access, Using adb you can clear cache.

rm -r /data/dalvik-cache
rm -r /cache/dalvik-cache
  • 1
    this requires root, and the question asks how to do that without root. – Dakatine Oct 2 '16 at 19:03
  • @Seo Shark This will delete all apps' cache, is there any way to delete a dpecific app's cache? – Shayan Dec 31 '18 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.