Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android NoClassDefFoundError:未能解析:Lio/realm/internal/LinkView_Android_Realm_Stetho - Fatal编程技术网

Android NoClassDefFoundError:未能解析:Lio/realm/internal/LinkView

Android NoClassDefFoundError:未能解析:Lio/realm/internal/LinkView,android,realm,stetho,Android,Realm,Stetho,我正在使用领域。我安装了Stetho Realm来查看领域数据 这就是我所做的 buildscript { ... repositories { google() jcenter() ... } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' ... classpath "io.realm:

我正在使用领域。我安装了Stetho Realm来查看领域数据

这就是我所做的

buildscript {
    ...
    repositories {
        google()
        jcenter()
        ...
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        ...
        classpath "io.realm:realm-gradle-plugin:5.1.0"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
        maven {
            url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
        }
    }
}
应用程序渐变

  • 听诊器:1.5.0
  • 听诊领域:2.1.0
  • 多重指数:1.0.3
  • 多索引启用真
这是格雷德密码

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
    compileSdkVersion 27
    defaultConfig {
        ...
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    ...

}

dependencies {
    ...
    // Stetho
    implementation 'com.facebook.stetho:stetho:1.5.0'
    implementation 'com.uphyca:stetho_realm:2.1.0'

}
我的应用程序类

public class MyApp extends Application{
    @Override
    public void onCreate() {
        super.onCreate();

        Realm.init(this);
        RealmConfiguration config = new RealmConfiguration.Builder().build();
        Realm.setDefaultConfiguration(config);

        // Stetho
        Stetho.initialize(
                Stetho.newInitializerBuilder(this)
                        .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                        .enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
                        .build());
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}
但是应用程序因此错误而崩溃: 在android studio上运行后,应用程序已正常安装。我在中单击了“检查”chrome://inspect/#devices:“应用程序出现在设备上后。此时,应用程序崩溃并显示错误。如何通过听诊器看到域db

E/AndroidRuntime: FATAL EXCEPTION: StethoWorker-main-13
    ...
    java.lang.NoClassDefFoundError: Failed resolution of: Lio/realm/internal/LinkView;
        at java.lang.reflect.Executable.getParameterTypesInternal(Native Method)
        at java.lang.reflect.Method.getParameterTypes(Method.java:179)
        at java.lang.Class.getDeclaredMethods(Class.java:1881)
        at com.facebook.stetho.inspector.MethodDispatcher.buildDispatchTable(MethodDispatcher.java:115)
        at com.facebook.stetho.inspector.MethodDispatcher.findMethodDispatcher(MethodDispatcher.java:53)
        at com.facebook.stetho.inspector.MethodDispatcher.dispatch(MethodDispatcher.java:60)
        at com.facebook.stetho.inspector.ChromeDevtoolsServer.handleRemoteRequest(ChromeDevtoolsServer.java:129)
        at com.facebook.stetho.inspector.ChromeDevtoolsServer.handleRemoteMessage(ChromeDevtoolsServer.java:111)
        at com.facebook.stetho.inspector.ChromeDevtoolsServer.onMessage(ChromeDevtoolsServer.java:87)
        at com.facebook.stetho.websocket.WebSocketSession$1.handleTextFrame(WebSocketSession.java:176)
        at com.facebook.stetho.websocket.WebSocketSession$1.onCompleteFrame(WebSocketSession.java:136)
        at com.facebook.stetho.websocket.ReadHandler.readLoop(ReadHandler.java:44)
        at com.facebook.stetho.websocket.WebSocketSession.handle(WebSocketSession.java:45)
        at com.facebook.stetho.websocket.WebSocketHandler.doUpgrade(WebSocketHandler.java:117)
        at com.facebook.stetho.websocket.WebSocketHandler.handleRequest(WebSocketHandler.java:83)
        at com.facebook.stetho.server.http.LightHttpServer.dispatchToHandler(LightHttpServer.java:84)
        at com.facebook.stetho.server.http.LightHttpServer.serve(LightHttpServer.java:61)
        at com.facebook.stetho.inspector.DevtoolsSocketHandler.onAccepted(DevtoolsSocketHandler.java:52)
        at com.facebook.stetho.server.ProtocolDetectingSocketHandler.onSecured(ProtocolDetectingSocketHandler.java:63)
        at com.facebook.stetho.server.SecureSocketHandler.onAccepted(SecureSocketHandler.java:33)
        at com.facebook.stetho.server.LazySocketHandler.onAccepted(LazySocketHandler.java:36)
        at com.facebook.stetho.server.LocalSocketServer$WorkerThread.run(LocalSocketServer.java:167)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "io.realm.internal.LinkView" on path: DexPathList[[zip file "/data/app/io.MyApp.app-xknjnMn3NM61rqAc4Zy3uA==/base.apk"],nativeLibraryDirectories=[/data/app/io.MyApp.app-xknjnMn3NM61rqAc4Zy3uA==/lib/arm64, /data/app/io.MyApp.app-xknjnMn3NM61rqAc4Zy3uA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]

我更喜欢使用RealmStudio而不是听诊器,听诊器适用于Windows和Mac。您可以使用adb命令简单地提取领域数据库文件

adb pull/[本地存储路径]/android/data//files/[realm file][pc上文件夹的路径]


Stetho领域未维护,不支持3.7.1以上的领域版本

但是,有一个社区分支:


事实上,从3.0开始,你就可以使用Android文件浏览器来复制你的文件了。太棒了!!结果如下所示。谢谢你的解决方案。如果成功了,你可能想接受答案,在左上角打勾。我必须添加
。WithDeleteIfMigrationRequired(true)
否则当你点击Chrome上的领域数据库时连接会断开(说“连接丢失”),我必须添加
WithDeleteIfMigrationRequired(true)
到Stetho Realm库,因为没有其他人这么做:PI可以看到很多东西(比如共享pref)和一些google数据库,但不能看到领域数据库
repositories {
    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())