Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: Failed resolution of: Lio/realm/internal/SharedRealm$Durability

I am trying to create a demo application using Realm to browse default.realm using Facebook's stetho. I am getting this error every time i try to open default.realm on google chrome using chrome://inspect > Resources > Web SQL > default.realm

This is what i have done.

build.gradle

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

dependencies {
    ...
    compile 'com.uphyca:stetho_realm:2.0.0'
    compile 'com.facebook.stetho:stetho:1.4.1'
}

My application class

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this).build();
        Realm.setDefaultConfiguration(realmConfiguration);

        Stetho.initialize(
                Stetho.newInitializerBuilder(this)
                        .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                        .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                        .build());
    }
}

App is crashing with this error :

E/AndroidRuntime: FATAL EXCEPTION: StethoWorker-main-304
                  Process: example.com.demoapp, PID: 12830
                  java.lang.NoClassDefFoundError: Failed resolution of: Lio/realm/internal/SharedRealm$Durability;
                      at com.uphyca.stetho_realm.RealmPeerManager.openSharedRealm(RealmPeerManager.java:136)
                      at com.uphyca.stetho_realm.RealmPeerManager.openSharedRealm(RealmPeerManager.java:128)
                      at com.uphyca.stetho_realm.RealmPeerManager.getDatabaseTableNames(RealmPeerManager.java:55)
                      at com.uphyca.stetho_realm.Database.getDatabaseTableNames(Database.java:124)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.facebook.stetho.inspector.MethodDispatcher$MethodDispatchHelper.invoke(MethodDispatcher.java:96)
                      at com.facebook.stetho.inspector.MethodDispatcher.dispatch(MethodDispatcher.java:67)
                      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.SharedRealm$Durability" on path: DexPathList[[dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-support-annotations-24.2.1_fe2fc8f98c9647365914a4e0809de4cf3bdd5d0f-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-realm-android-0.87.4_a528e85f9603c6e64968c150f61258a1621159d0-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-jsr305-2.0.1_54f738210fc8c811d7251e6035f61735e3c90b00-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-internal_impl-24.2.1_d63817604dbcd8615733073ed4cf6bd29db871e2-classes.dex", dex file "/data/data/example.com.demoapp/files/instant-run/dex/slice-internal_impl-24.2.1_d432bb06a79cf966d865aa5fa44c857409504f1f-classes.dex", dex file "/data/data/example.com.d
like image 493
Rana Ranvijay Singh Avatar asked Nov 29 '16 12:11

Rana Ranvijay Singh


1 Answers

You are using an extremely outdated version of Realm, which Stetho-Realm 2.0.0 does not support.

You should use the 1.x branch of Stetho-Realm to open your Realm.

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

dependencies {
    compile 'com.facebook.stetho:stetho:1.3.1'
    compile 'com.uphyca:stetho_realm:0.9.0'
}
like image 199
EpicPandaForce Avatar answered Oct 12 '22 18:10

EpicPandaForce