View and pull cache files of an app

suggest change

You may use this command for listing the files for your own debuggable apk:

adb shell run-as <sample.package.id> ls /data/data/sample.package.id/cache

Angle brackets are placeholders. A shell treats < and > as redirection, so replace <sample.package.id> with the package name before you run the command. The ls path above leaves that package name unbracketed.

This script copies a cache file to the sdcard, pulls it, and then removes the copy:

#!/bin/sh
adb shell "run-as <sample.package.id> cat '/data/data/<sample.package.id>/$1' > '/sdcard/$1'"
adb pull "/sdcard/$1"
adb shell "rm '/sdcard/$1'"

Then you can pull a file from cache like this:

./pull.sh cache/someCachedData.txt

Get Database file via ADB

sudo adb -d shell "run-as com.example.name cat /data/data/com.example.name/databases/STUDENT_DATABASE > /sdcard/file"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents