Android debugging tool--Facebook Stetho--You can view the data in the data directory without rooting the mobile device

My CSDN blog is released at the same time: Android debugging tool -- Facebook Stetho -- you can view the data in the data directory without rooting the mobile device

I. Introduction

    In android development, we will write a configuration file in SharePreference, or save it to the local database SQLite, but these are all under the /data/data/<package_name> package, and then this directory can only be seen after root, in my development every time If you want to view the data under data every time you change a device, you need to root. However, rooting Huawei, Xiaomi, Samsung, and these phones is too laborious, and wastes time looking for tutorials everywhere. Many phones have to unlock them on the official website. Anyway, I am very I am disgusted with this, but this is because the manufacturer's security is also good enough. At this point, I wonder if I can view the data under the data without root. After a lot of tossing, I finally found a good tool. Thank you Facebook, 666

Second, the love of Stetho tools

    Stetho is a powerful Android debugging tool produced by Facebook. After integrating Stetho in the application, you can easily view the interface layout, network request data, SQLite database, SharePreference and other information of the APP by opening Chrome DevTools. The mobile device is rooted, does it feel very 666 when you see it? Here is how to use it.
        The integration of Stetho is very simple, first add a dependency on the Stetho function library in Gradle
--------------------------------- -------------------------------------------------- -------------------------
 dependencies {
        //Use the core function library that Stetho must introduce
         compile 'com.facebook.stetho:stetho:1.3.1 '
}
------------------------------------------------ -------------------------------------------------- ----------
Then add the Stetho initialization code in the onCreate function of the Application class of the project
-------------------------- -------------------------------------------------- --------------------------------

------------------------------------------------------------------------------------------------------------

    After the basic configuration of Stetho is completed, it has the ability to view the database, view the View Hierarchy, and use the default dumpapp tool. At this time, open the Chrome browser, enter chrome://inspect in the address bar to open DevTools, connect the mobile phone to the computer via USB, open the APP integrated with Stetho, and you can see the page shown in the following figure in Chrome.

After reading the app in the mobile phone, you can view the data under the data. Personally, I think the sqlite screen on the mobile phone is too small, and it is always incomplete. It is really convenient to view it through the PC browser. Now that you see the name of the currently opened application package, click the inspect button next to it to open the monitoring page. If this page is opened for the first time, it is blank. Why? Because this page needs to download a plug-in, this plug-in needs to bypass the wall. The wall-climbing tool I use here is the blue light, a wall-climbing tool specially created by Google for Chinese people, https://github.com/getlantern/lantern , the second There will be no blanks when opened again,

After opening it is as follows:

How to switch to view view?

Do you feel very 666, no hurry, and how to check the data under data?

Switch to the resources tab below:

 

 

After reading it, is it very clear? I feel like you can try it out. Say goodbye to root to view data data forever!

 

3. Open source code base

Finally, I will share a code base that I have accumulated for a long time, only you can't think of it, there is nothing you can't use, welcome to star

https://github.com/xijiufu

Since the github server is in the United States, access is sometimes very slow, and an open-source Chinese address library is also provided, and the codes of the two warehouses are updated synchronously:

http://git.oschina.net/xijiufu

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325478852&siteId=291194637