Android uses ADB commands and Stetho to view the app database

Source: Internet
Author: User

One. Use the ADB command to view

Open a command window and go to Platform-tools in the Android SDK directory to execute the command:

1. Input: Under Windows: adb shell under Linux: ./adb Shell

2. Enter Data/data: If the phone does not have root, use the command Run-as package name to go directly to/data/data

3. Go to databases: CD databases

4. Use the ls command to list all databases in the current directory

5. Use the sqlite3 database name

6. Finally, you can execute the corresponding SQL statement, note that after the SQL statement, add a semicolon

Note: If you want the ADB command to be available in any directory, just configure its environment variables (as per the method of configuring the JDK)

Some phones may not find the package name using the run-as package name command (not resolved), and some phones cannot find the sqlite3 command (not resolved)

Two. Using Facebook's Stetho

1. Search Stetho on GitHub to open the first Facebook/stetho

2. Open Build.gradle (Module:app) in Android Studio and enter it in dependencies

Compile ' com.facebook.stetho:stetho:1.3.1 '

There's a sync now on the top right.

3. Create a new class in the app with the following code:

 Public class extends Application {  publicvoid  onCreate () {    super. OnCreate ();    Stetho.initializewithdefaults (this);}  }

4. Configure the Name property of the application in manifests:

Android:name= ". MyApplication "

5. Finally enter the URL in the Chrome browser

Chrome://inspect (may require FQ)

6. Connect your phone to your computer, run the app, show the app's package name below devices, click the inspect below, and choose Resources,websql to see your app's database

Android uses ADB commands and Stetho to view the app database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.