Android 使用google浏览器查看手机数据库的方法

记录一个使用手机查看数据库的快捷方法:

1、在应用App的build.gradle中添加如下代码:

// 查看数据库
implementation 'com.facebook.stetho:stetho:1.5.0'

2、在应用App的application类的oncreate方法中添加如下代码:

 Stetho.initializeWithDefaults(this);

然后导入包:

import com.facebook.stetho.Stetho;

编译,将apk push到设备里

3、在google浏览器中打开链接如下:

chrome://inspect/#devices

image 1

4、点击inspect就可以查看数据库了

image

注意:编译时如果遇到类似问题,修改“com.google.code.gson:gson”版本为compile classpath (2.8.2)即可:

Conflict with dependency ‘com.google.code.gson:gson‘ in project ‘:cmcc_voice_assistant’. Resolved versions for runtime classpath (2.8.5) and compile classpath (2.8.2) differ. This can lead to runtime crashes. To resolve this issue follow advice at https://developer.android.com/studio/build/gradle-tips#configure-project-wide-properties. Alternatively, you can try to fix the problem by adding this snippet to /home/cl/sdb1-cl/master_c03/android/vendor/grandstream/apps/Cmcc/cmcc_voice_assistant/build.gradle:

0