How do I view Android application specific cache?
Solution 1
Unless ADB is running as root (as it would on an emulator) you cannot generally view anything under /data unless an application which owns it has made it world readable. Further, you cannot browse the directory structure - you can only list files once you get to a directory where you have access, by explicitly entering its path.
Broadly speaking you have five options:
Do the investigation within the owning app
Mark the files in question as public, and use something (adb shell or adb pull) where you can enter a full path name, instead of trying to browse the tree
Have the owning app copy the entire directory to the SD card
Use an emulator or rooted device where adb (and thus the ddms browser's access) can run as root (or use a root file explorer or a rooted device)
use adb and the run-as tool with a debuggable apk to get a command line shell running as the app's user id. For those familiar with the unix command line, this can be the most effective (though the toolbox sh on android is limited, and uses its tiny vocabulary of error messages in misleading ways)
Solution 2
You may use this command for listing the files for your own debuggable apk:
adb shell run-as com.corp.appName ls /data/data/com.corp.appName/cache
And this script for pulling from cache:
#!/bin/sh
adb shell "run-as com.corp.appName cat '/data/data/com.corp.appNamepp/$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
Root is not required.
Solution 3
On Android Studio you can use Device File Explorer
to view /data/data/your_app_package/cache.
Click View > Tool Windows > Device File Explorer
or click the Device File Explorer
button in the tool window bar to open the Device File Explorer.
Solution 4
You can check the application-specific data in your emulator as follows,
- Run
adb shell
in cmd - Go to
/data/data/
and navigate into your application
There you can find the cache data and databases specific to your application
Solution 5
Question: Where is application-specific cache located on Android?
Answer: /data/data
Karim Varela
Technology executive, investor, and advisor with a career history of producing highly scalable digital consumer products. Exceptional record of success in building and leading top performing, global engineering teams, managing budgets as large as $5MM, and bringing order and agility to growing engineering teams. Excels at implementing agile engineering practices, building product-focused engineering teams, and delivering software on time. Outstanding problem solving, leadership, and team motivation skills. —————— Core skills —————— Transformational Leadership: Carried out agile restructurings and process improvements which have resulted in massive improvements to engineering productivity. Platform Migration: Carried out multiple platform and database migrations resulting in cost-savings, improved operational efficiency, and better system performance. Global Workforce Management: Supervised as many as 25 people, across distributed teams in the US, Mexico, Argentina, Dominican Republic, Poland, Ukraine, London, India, and The Netherlands. Scaling Products Globally: Played key roles in localizing and distributing mobile apps and services to key international markets, growing user bases to tens of millions of users. System Architecture: Architected and built multiple secure and performant systems from the ground up to handle workloads in social, banking, and travel. —————— Specific Skills —————— Process Optimization Strategy, Planning, & Execution Engineering Operations Budget & Cost Control Product Management Lean & Agile Methodologies Cloud Architecture Microservices ETL Web Services Relational Databases NoSQL Databases Coaching & Mentoring Machine Learning
Updated on May 13, 2021Comments
-
Karim Varela about 3 years
Is there any way to dynamically view the application specific cache in Android? I'm saving images to the cache (/data/data/my_app_package/cache) and I'm 99% sure they're saving there, but not sure how long they're staying around.
When I look in the cache using the DDMS File Explorer within Eclipse, it's always empty. I've also tried examining the appropriate cache dir in ADB and again it's always empty.
Any suggestions?