Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access data/data folder in Android device?

I am developing an app and I know my database *.db will appear in data/data/com.****.***

I can access this file from AVD in Eclipse with help of sqlite manager

But I can't access this file in my Android phone.
I googled it and it says I need to root my phone to do it, but I don't want to do that.

How can I access my data/data/..... directory in my Android phone "without rooting it"?

Can I change user permissions for the directory data/data..... without rooting it?

like image 364
Naveen Prince P Avatar asked Oct 22 '12 06:10

Naveen Prince P


People also ask

How do I access data folder on Android?

Please go to Android system settings, find storage section, click it. From the storage page, find "Files" item, and click it. If there are multiple file managers to open it, please make sure to choose "Open with Files" to open it, which is the system file manager app.

What is Android data folder?

The application data folder is a special hidden folder that your app can use to store application-specific data, such as configuration files. The application data folder is automatically created when you attempt to create a file in it. Use this folder to store any files that the user shouldn't directly interact with.


2 Answers

Accessing the files directly on your phone is difficult, but you may be able to copy them to your computer where you can do anything you want with it. Without rooting you have 2 options:

  1. If the application is debuggable you can use the run-as command in adb shell

    adb shell run-as com.your.packagename  cp /data/data/com.your.packagename/ 
  2. Alternatively you can use Android's backup function.

    adb backup -noapk com.your.packagename 

    You will now be prompted to 'unlock your device and confirm the backup operation'. It's best NOT to provide a password, otherwise it becomes more difficult to read the data. Just click on 'backup my data'. The resulting 'backup.ab' file on your computer contains all application data in android backup format. Basically it's a compressed tar file. This page explains how you can use OpenSSL's zlib command to uncompress it. You can use the adb restore backup.db command to restore the backup.

like image 157
THelper Avatar answered Sep 30 '22 04:09

THelper


If you are using Android Studio 3.0 or later version then follow these steps.

  1. Click View > Tool Windows > Device File Explorer.
  2. Expand /data/data/[package-name] nodes.

You can only expand packages which runs in debug mode on non-rooted device.

Steps followed in Android Studio 3.0

like image 25
Shahidul Avatar answered Sep 30 '22 05:09

Shahidul