Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Device Monitor "data" folder is empty

I have tested creating, inserting and retrieving data into my apps db, and know it works through usage of Log statements.

However, I wish to expedite testing and use the Android Device Monitor. However, though the db exists and data is stored, when accessing below, the data folder is empty:

enter image description here

Why would this be the case? How can this be configured to show the db file and contents?

like image 444
Sauron Avatar asked Jan 05 '16 02:01

Sauron


4 Answers

Solving the issue using an emulator

The folder /data can be empty because you are missing the proper permissions. To solve it, I had to execute the following commands.

adb shell
su

Those commands starts a shell in the emulator and grant you root rights. The command adb is located in the folder platform-tools of the Android SDK, typically installed in ~/Library/Android/sdk/ on MacOS.

chmod -R 777 /data

Modify the permissions of the folder (and subfolders recursively) /data in order to make them appear in the tool Android Device Monitor.

adb root

Finally, this command restarts adb as root. Be careful, it only works on development builds (typically emulators builds).

Afterwards, you can see the content of the folder /data and transfer the data located in. You can do it in console as well, using adb pull <remote> <locale>, such as:

adb pull /data/data/<app name>/databases/<database> .
like image 90
Jämes Avatar answered Nov 20 '22 20:11

Jämes


In addition to @Steven K's answers: If you want to gain access to your data without having to root your real device you need to run your app in an emulator with API 23 (or lower). It is a known problem that APIs above 23 can cause problems when deploying Android Device Monitor.

like image 22
Jonathan Rhein Avatar answered Nov 20 '22 20:11

Jonathan Rhein


If anyone is having the stated problem, follow below steps in terminal window:

  1. Navigate to /Users/Username/Library/Android/sdk/platform-tools
  2. Execute ./adb root

That's it. Problem solved.

like image 10
Sankara Narayanan Avatar answered Nov 20 '22 18:11

Sankara Narayanan


It isn't empty....you just don't have permission to view that folder on a device.

Try it in a simulator and it will work for you since you have root access.

like image 8
Steven K Avatar answered Nov 20 '22 18:11

Steven K