Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio DDMS can't open /data folder in an emulator phone

I recently created an Emulator device with Android Studio,but only to find that I can't open the /data/data folder to get the sqlite db file.The folder just can't open,I have tried to use shell scirpt to chmod the /data directory,but it says the su command not found.

The Emulator

Can't open!

Is there anyone has the same problem? Or I have to root the Emulator? But it's an Emulator! I just think it's kind of inconvenient to root a Emulator!

like image 493
Kevin Zheng Avatar asked Jun 09 '17 09:06

Kevin Zheng


People also ask

How do I access internal storage on Android Emulator?

In Android N emulator you can easily get access Internal Memory. Then a pop up will open. Click on explore . Then you will get access of Internal Storage.


3 Answers

Update

Can't remember whether it's from Android Studio 3.0 or later but if you have downloaded AS 3.3+, you'll find the tab on bottom right corner called Device File Explorer, which lets you to see and easily get the data of your app without rooting.


Opening as Administrator didn't help but rooting the phone did worked, and no I'm not lowering my SDK version.

Open cmd and go to C:\Users\{User}\AppData\Local\Android\Sdk\platform-tools or to the folder location and type cmd at the address bar.

open cmd on the current folder

Whether you're super user or not can be determined by $:

C:\{User}\...\platform-tools>adb shell
generic_x86:/ $ exit

To have su/root privileges type adb root and exit:

C:\{User}\...\platform-tools>adb root
generic_x86:/ # exit

Next run the Android Device Monitor to extract the data.

To turn off root type adb unroot.

like image 111
Rajarshi Avatar answered Oct 16 '22 19:10

Rajarshi


Even after running Android Studio as administrator if you can't access data/data folder, try using API 23 or lower for you emulator device.

like image 38
Tushar Nitave Avatar answered Oct 16 '22 18:10

Tushar Nitave


Using Android Studio 3.1.2 and DDMS is no longer available under the Tool options. Instead Android Studio has the "Device File Explorer" tab available on the bottom right (I know why put it there).

Click on the "Device File Explorer" tab and select the Android Device you want to explore. To actually access the files, make sure USB Debugging is turned on in the AVD.

If that doesn't work, you'll need to use Terminal panel.

  1. Change the folder permission through adb shell (using chmod command)
  2. Pull the file using "adb pull". See example:

C:\Users\B\AppData\Local\Android\sdk\platform-tools> adb pull /data/data/com.example.b.expensewatcher/databases/myexpenses.db

/data/data/com.example.b.expensewatcher/databases/myexpenses.db: 1 file pulled. 3.3 MB/s (24576 bytes in 0.007s)

For more details on changing folder permissions see: https://www.dev2qa.com/android-device-monitor-cannot-open-data-folder-resolve-method/

like image 23
Bruke Avatar answered Oct 16 '22 18:10

Bruke