Android Device Monitor “data” folder is empty

前端 未结 9 1302
深忆病人
深忆病人 2020-12-02 13:04

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 us

相关标签:
9条回答
  • 2020-12-02 13:33

    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.

    0 讨论(0)
  • 2020-12-02 13:39

    I had same problem with API_25, it didn't work for me.

    Configure an API_23 emulator, it will work on API_23.

    0 讨论(0)
  • 2020-12-02 13:40

    In cmd GoTo:

    C:\Users\UserName\android-sdks\platform-tools
    

    Execute:

    adb root
    

    Done

    0 讨论(0)
  • 2020-12-02 13:41

    It may be easier to store the database in a public folder during development.

    Or you can see this post :

    How to access data/data folder in Android device?

    0 讨论(0)
  • 2020-12-02 13:42

    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> .
    
    0 讨论(0)
  • 2020-12-02 13:52

    There are two ways if you want to browse your device data (data/data) folder.

    1. You need to have a phone with root access in order to browse the data folder using ADM(Android Device Monitor).

    ADM location - (YOUR_SDK_PATH\Android\sdk\tools)

    1. You need to be running ADB in root mode, do this by executing: adb root

    If you just want to see your DB & Tables then the esiest way is to use Stetho. Pretty cool tool for every Android developer who uses SQLite buit by Facobook developed.

    Steps to use the tool

    1. Add below dependeccy in your application`s gradle file (Module: app)

    'compile 'com.facebook.stetho:stetho:1.4.2'

    1. Add below lines of code in your Activity onCreate() method
    @Override
     protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     Stetho.initializeWithDefaults(this);
     setContentView(R.layout.activity_main);
     }
    

    Now, build your application & When the app is running, you can browse your app database, by opening chrome in the url:

    chrome://inspect/#devices
    

    Screenshots of the same are as below_

    ChromeInspact

    Your DB

    Hope this will help all! :)

    0 讨论(0)
提交回复
热议问题