Android Device Monitor “data” folder is empty

前端 未结 9 1310
深忆病人
深忆病人 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: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! :)

提交回复
热议问题