代码之家  ›  专栏  ›  技术社区  ›  yozhik

如何显示领域数据库内容?

  •  0
  • yozhik  · 技术社区  · 6 年前

    我在android手机上有realm数据库。我试图将数据保存到领域数据库,然后从那里获取数据。但我不确定我做得是否正确,因为它不包含一些数据。我想看看原始状态的记录,以了解我错在哪里。但是Gradle没有在这个基础上建立项目。有人知道如何用其他工具查看数据吗?谢谢。4.4.1

        io.realm:realm-gradle-plugin:5.1.0
        implementation 'com.facebook.stetho:stetho:1.5.0'
        implementation 'com.uphyca:stetho_realm:2.2.0'
    
    Stetho.initialize(
                    Stetho.newInitializerBuilder(this)
                            .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                            .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                            //.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
                            .build());
    
    
    buildscript {
        repositories {
            jcenter()
            mavenCentral()
            maven {
                url 'https://maven.google.com'
            }
            maven { url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo' }
        }
    }
    apply plugin: 'com.android.application' //here shows error: Failed to resolve: com
    apply plugin: 'io.fabric'
    
    android {
    
    2 回复  |  直到 6 年前
        1
  •  2
  •   user8873209    6 年前

    有另一种手动方式来查看领域数据库的记录,但您需要mac os来实现这一点。

    1-在模拟器中运行应用程序。

    2-转到“工具”->“Android设备监视器”

    3-找到你的应用程序包名称,现在你可以看到你的应用程序的所有文件。

    4-找到领域文件并通过将其导出到您的计算机进行复制。

    5-现在安装 Realm Browser 在Mac OS上。

    6-通过领域浏览器打开数据库的复制文件。

    您可以看到数据库的所有表和记录。

        2
  •  3
  •   EpicPandaForce Jigar Joshi    6 年前

    this issue ,如果使用由wickedev管理的较新版本,则听诊器领域可与领域4.0.0+一起使用:

    repositories {
        mavenCentral()
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
        maven { url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo' }
    }
    
    dependencies {
        implementation 'com.uphyca:stetho_realm:2.3.0'
    }
    val realmInspector = RealmInspectorModulesProvider.builder(this)
                .withDeleteIfMigrationNeeded(true)
                .build()
    
    Stetho.initialize(Stetho.newInitializerBuilder(this)
                .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                .enableWebKitInspector(realmInspector)
                .build())