记录一个使用手机查看数据库的快捷方法:
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

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

注意:编译时如果遇到类似问题,修改“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: