Good news for debugging database in mobile phone: Android-Debug-Database

Good news for debugging database in mobile phone: Android-Debug-Database

Currently, debugging apps in the browser is becoming more and more popular.

For example, Facebook's open source tool Stetho allows Chrome to debug Android.

This article introduces an open source project "Android-Debug-Database".

He can debug the DB in the browser

It involves "getting data - starting service - remote call", I hope it will be useful to everyone

Preface

Generally, it is very troublesome to debug the database in the mobile phone. Generally speaking, there are several ways to do it:

Export the SQLite database in the mobile phone to the computer, view the database through the computer software, execute the relevant SQL statements, and see the results.

Root your phone, install RE File Manager on your phone, go to the application package, find the file of your database, and then check the database.

Android Studio has related plug-ins, which makes operation convenient, but some of them require payment and are not very pleasant to use.

Now, AMIT SHEKHAR has open-sourced Android-Debug-Database. With this library, we can easily view the database through the browser and execute SQL statements. Isn't it great!

feature

  1. You can view all databases in your application.
  2. You can view all shared preferences of your application (extra benefit).
  3. Executes a SQL statement against the database you specify.
  4. Visually edit the data in the database you specify.
  5. Download the database directly.

How to use

Add the following to your build.gradle: debugCompile 'com.amitshekhar.android:debug-db:1.0.0' The function of debugCompile: It only works when you debug compile. There is no need to use it when you release.

That's it, you don't need any other code.

Next, when you start the App, you should check your logcat, there will be a line like this: D/DebugDB: Open http://XXX.XXX.X.XXX:8080 Copy it to your computer's browser, you can see the database in your App and shared preferences

The interface is as follows:

principle

The overall structure is as follows:

DebugDB starts a thread for your application:

This thread continuously processes requests from the browser (Socket form)

According to the content sent by the Socket, it makes judgments: according to different requests, it processes and returns different results:

Others: Where does the content in the browser come from? Why can it send request data? debug-db sends interactive HTML to the browser:

The interactive capabilities of the browser are based on HTML and JS. These designs involve front-end knowledge. Let's talk about it when we have time.

<<:  Use Jenkins to build iOS/Android continuous integration packaging platform

>>:  VMplay Ai Qiwei: The era of free app downloads is coming

Recommend

Heat stroke? Summer cold? ——Tell you how to identify and prevent it

This is the 4402nd article of Da Yi Xiao Hu "...

Who is most likely to become the fourth pole of China's Internet?

[[157689]] BAT has already occupied an absolutely...

Phenomenal marketing cases in the first half of 2019!

2019 is already halfway over, so let’s follow the...

Why can domestic mobile phones occupy nearly half of the market share in India?

Not long ago, according to overseas media reports...

Introduction to Glide: Image loading library for Android

As an Android developer, you're probably fami...

How should short video advertisements such as Douyin and Kuaishou be placed?

1. Take a holistic view and use data to understan...

How can Internet finance carry out precision marketing?

The cost of acquiring traffic in Internet finance...

Hu Q&A丨What is sleep paralysis? Is it really a ghost?

Source of this issue: Anhui Institute of Optics a...

Case analysis: How are promotional marketing activities planned and implemented?

Next, let’s talk about the design forms of market...

Why do companies rely on Baidu bidding hosting today?

Why businesses rely on Baidu hosting today With t...

Cocos 2d-x v3.7 released - unified! powerful! all in one!

Recently, Cocos, the leading mobile game engine i...