20

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.

3
  • Relevant answer on Stack Overflow.
    – Firelord
    May 26, 2015 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, 2015 at 21:46
  • 1
    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, 2015 at 21:56

3 Answers 3

21

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.

4
  • 1
    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, 2015 at 0:09
  • 2
    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, 2015 at 6:03
  • 1
    So there's no way to ONLY clear cache? @Izzy
    – Shayan
    Dec 31, 2018 at 0:00
  • @Shayan not that I know of – except on rooted devices (see Seo's answer for that).
    – Izzy
    Dec 31, 2018 at 7:22
4

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

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

You can use Zero Cleaner app, it's like cleaning the app catches manually, but it's automatized, and requires accessibility permission.

2
  • 1
    Does it use ADB though ? Jul 24, 2023 at 11:22
  • Nope, it works like you 'd manually clicking the clean cache button at every single app, but it does it automatized.
    – gurtnyi
    Aug 15, 2023 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .