1

我正在使用 Realm gradle plugin 5.11.0 和 stetho realm 2.1.0 ,但是当我连接到 chrome 时应用程序崩溃并且我无法检查数据库。我低于异常

E/AndroidRuntime: FATAL EXCEPTION: StethoWorker-main-5
Process: kt.esense.com.realmsample, PID: 2201
java.lang.NoClassDefFoundError: io.realm.internal.LinkView
    at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
    at java.lang.Class.getDexCacheType(Class.java:2551)
    at java.lang.reflect.AbstractMethod.getParameterTypes(AbstractMethod.java:169)
    at java.lang.reflect.Method.getParameterTypes(Method.java:193)
    at java.lang.Class.getDeclaredMethods(Class.java:1812)
    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/kt.com.realmsample-1/base.apk"],nativeLibraryDirectories=[/data/app/kt.com.realmsample-1/lib/arm64, /data/app/kt.com.realmsample-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:74)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
4

1 回答 1

0

对于 Realm 3.7.1-3.7.2,Stetho-Realm 根本无法工作(除非你 fork 它并为代码修复它)

对于 Realm 4.0.0+(包括您的 Realm 5.11.0 版本),您需要使用支持 Realm 4.0+ 的 WickeDev 的 fork。

repositories {
    maven { url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo' }
}

dependencies {
    implementation 'com.uphyca:stetho_realm:2.3.0'
}
于 2019-05-31T14:20:31.150 回答