2

I am using Realm gradle plugin 5.11.0 and stetho realm 2.1.0 , but when I connect to chrome it crashed app and I am not able to inspect db. I am getting below exception

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)
Sagar Jethva
  • 986
  • 12
  • 26

1 Answers1

0

For Realm 3.7.1-3.7.2, Stetho-Realm won't work at all (unless you fork it and fix it for the code)

For Realm 4.0.0+ (that includes your version Realm 5.11.0), you need to use WickeDev's fork that supports Realm 4.0+.

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

dependencies {
    implementation 'com.uphyca:stetho_realm:2.3.0'
}
EpicPandaForce
  • 79,669
  • 27
  • 256
  • 428
  • That is impossible. stetho-realm 2.3.0 should handle this scenario. That means you are having multiple library versions in your code without realizing it, you should use `gradlew dependencies` to find out what's giving you multiple Realm versions. – EpicPandaForce Jun 05 '19 at 11:49
  • ive realm 6.0.1 and it says connection lost when I click on my database from stetho web sql – Ahmad Shahwaiz Jun 04 '20 at 01:45
  • Using the Stetho-Realm version outlined here? – EpicPandaForce Jun 04 '20 at 03:31
  • The WickeDev repo no longer exists... are there any alternatives? I tried the `https://github.com/uPhyca/stetho-realm` but it has an older version (that also does not seem to work)... – m_katsifarakis May 01 '21 at 10:21
  • Oh god, that's terrible news! The repo was directly referenced from GIthub, this will break MANY builds! I seem to have a version of the 2.3.0 on https://github.com/Zhuinden/stetho-realm as I didn't delete the fork, but that still wouldn't support anything above Realm 7. The internals should be rewritten to use DynamicRealm... – EpicPandaForce May 02 '21 at 08:03
  • 1
    @EpicPandaForce it seems that the .pom is missing for 2.3.0. It's available only up until 2.2.2: https://github.com/Zhuinden/stetho-realm/tree/master/maven-repo/com/uphyca/stetho_realm. Yet it works like a charm, for Realm 6.0.2. Thank you! – wverdese Jun 14 '21 at 14:46