Realm-java: Updated Realm Version not supporting to view Realm Data using Stetho-Realm

Created on 26 Oct 2016  Â·  31Comments  Â·  Source: realm/realm-java

I just love to use Realm and waiting for Windows version of Realm Browser, currently using Stetho for viewing Data in chrome Browser.

I used Realm version 0.87 till some days ago, all the thing is perfect. But recently updated to the latest Realm Version and from there on its Stopped the support when using the Stetho.

It says "Detached from the target" when i click the Realm Database name Expanding Web SQL. Every Time the same thing happens, Please help me to get rid of this error. The only way also now closed to view the Database of Realm.. How to resolve this?

Version of Realm and tooling

Realm version(s): 2.0.2

Realm sync feature enabled: yes

Android Studio version: 2.2.2

image

O-Community T-Bug

Most helpful comment

You are completely right the problem was in me and my code! I manage to fix everything now and get how exactly realm works, but still there is no available method to check your realm db that i found so far.

@Zhuinden did you manage to find anything that works with the latest libs?

All 31 comments

Did you also update Stetho-Realm?

No, it was the version when i started using stetho.. Let me check any update in stetho

After updated the stetho Library, Now the error is gone, but when i expand the Database.Realm it just the icon is expanding but no Table is shown.

I mean not just stetho, but https://github.com/uPhyca/stetho-realm

Am using only https://github.com/uPhyca/stetho-realm in Android. There is no need of using stetho, but still the issue occurs, No Table is showing when expanding the Database.Realm

@zaki50 do you know anything about this?

@zaki50 The exact problem is,
i run the application, inspecting the app with chrome://inspect/#devices

The Database.Realm is showing in Web SQL section,
1

When i try to expand the Database its not showing the Table's, instead it just expands the icon itself.
2

Later i closed the Inspect window then again inspected the app, now its showing default.realm Database as Extra, i didn't use any default database in my app.
3

Even now also Table's not showing. Help me with this issue, i hope for all who is using latest Realm will surely Encounter this issue.

@bsmn99 Could you provide a code that creates RealmConfiguration object in your application?

@zaki50 here is the configuration, its very simple too..

Realm.init(this); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder() .name("Database.realm") .schemaVersion(8) .build(); Realm.setDefaultConfiguration(realmConfiguration);

@zaki50 What happened? Still issue persist.. help me please..

Am getting this exception stack trace while inspecting Realm in chrome with stetho-realm

D/ChromeDevtoolsServer: onOpen D/ChromeDevtoolsServer: Method not implemented: Not implemented: Page.canEmulate D/ChromeDevtoolsServer: Method not implemented: Not implemented: Console.setTracingBasedTimeline I/ResponseBodyFileManager: Cleaned up temporary network files. D/ChromeDevtoolsServer: Method not implemented: Not implemented: Debugger.setAsyncCallStackDepth D/ChromeDevtoolsServer: Method not implemented: Not implemented: Debugger.skipStackFrames D/ChromeDevtoolsServer: Method not implemented: Not implemented: Runtime.enable D/ChromeDevtoolsServer: Method not implemented: Not implemented: Worker.enable D/ChromeDevtoolsServer: Method not implemented: Not implemented: Timeline.enable D/ChromeDevtoolsServer: Method not implemented: Not implemented: IndexedDB.enable D/ChromeDevtoolsServer: Method not implemented: Not implemented: Page.getNavigationHistory D/ChromeDevtoolsServer: Method not implemented: Not implemented: Worker.setAutoconnectToWorkers D/ChromeDevtoolsServer: Method not implemented: Not implemented: IndexedDB.requestDatabaseNames Method not implemented: Not implemented: Page.getNavigationHistory D/ChromeDevtoolsServer: Method not implemented: Not implemented: ApplicationCache.enable D/ChromeDevtoolsServer: Method not implemented: Not implemented: ApplicationCache.getFramesWithManifests D/ChromeDevtoolsServer: onClose: reason=1011 EOF while reading

@cmelchior i have explained the exact issue clearly to @zaki50

@bsmn99 Thanks. I'll check it.

Having the same. It works fine when i only use the "default.realm" database filename. If i use a custom name it does not show any content

There is an outstanding PR which should solve this: https://github.com/uPhyca/stetho-realm/pull/38

There is currently no way possible to view anything from Realm with any of the options that thy provide at this point i personally tested all of them on emulator and a physical device and nothing works! If you are on a mac nothing works at all....Even there are a lot strange things about realm...

The purpose and the idea sounds awesome but i still cannot find a way to actually use it as it have to be used since there is no logical way....

No AutoInc? Seriously? You have to implement all of it your self and on the end of that doesn't work since there is no RealmArray it i only RealmList and you have to implement all of it on hand so my questions will be is there any way possible for this to be used? I have a class which contains a nested class and that class is an Array.

Please would love to get some answers on this.

@nikiizvorski map your array into a RealmList and save it with realm.copyToRealmOrUpdate()

Nope that is not going to work you can try yourself. Here you go try this:

http://api.fixer.io/latest?base=EUR

JSON is this

{
    "base": "EUR",
    "date": "2017-01-19",
    "rates": {
        "AUD": 1.4113,
        "BGN": 1.9558,
        "BRL": 3.4223,
        "CAD": 1.4169,
        "CHF": 1.0729,
        "CNY": 7.3241,
        "CZK": 27.021,
        "DKK": 7.436,
        "GBP": 0.86555,
        "HKD": 8.2762,
        "HRK": 7.521,
        "HUF": 308.4,
        "IDR": 14266.0,
        "ILS": 4.0669,
        "INR": 72.688,
        "JPY": 122.23,
        "KRW": 1255.9,
        "MXN": 23.444,
        "MYR": 4.7462,
        "NOK": 9.0193,
        "NZD": 1.4857,
        "PHP": 53.405,
        "PLN": 4.3728,
        "RON": 4.4928,
        "RUB": 63.58,
        "SEK": 9.5478,
        "SGD": 1.5216,
        "THB": 37.759,
        "TRY": 4.0747,
        "USD": 1.0668,
        "ZAR": 14.506
    }
}

GSON needs this

    package com.example;

    import com.google.gson.annotations.Expose;
    import com.google.gson.annotations.SerializedName;

    public class Response {
        @SerializedName("base")
        @Expose
        public String base;
        @SerializedName("date")
        @Expose
        public String date;
        @SerializedName("rates")
        @Expose
        public Rates rates;

    public class Rates {
        @SerializedName("AUD")
        @Expose
        public Double aUD;
        @SerializedName("BGN")
        @Expose
        public Double bGN;
        @SerializedName("BRL")
        @Expose
        public Double bRL;
        @SerializedName("CAD")
        @Expose
        public Double cAD;
        @SerializedName("CHF")
        @Expose
        public Double cHF;
        @SerializedName("CNY")
        @Expose
        public Double cNY;
        @SerializedName("CZK")
        @Expose
        public Double cZK;
        @SerializedName("DKK")
        @Expose
        public Double dKK;
        @SerializedName("GBP")
        @Expose
        public Double gBP;
        @SerializedName("HKD")
        @Expose
        public Double hKD;
        @SerializedName("HRK")
        @Expose
        public Double hRK;
        @SerializedName("HUF")
        @Expose
        public Double hUF;
        @SerializedName("IDR")
        @Expose
        public Double iDR;
        @SerializedName("ILS")
        @Expose
        public Double iLS;
        @SerializedName("INR")
        @Expose
        public Double iNR;
        @SerializedName("JPY")
        @Expose
        public Double jPY;
        @SerializedName("KRW")
        @Expose
        public Double kRW;
        @SerializedName("MXN")
        @Expose
        public Double mXN;
        @SerializedName("MYR")
        @Expose
        public Double mYR;
        @SerializedName("NOK")
        @Expose
        public Double nOK;
        @SerializedName("NZD")
        @Expose
        public Double nZD;
        @SerializedName("PHP")
        @Expose
        public Double pHP;
        @SerializedName("PLN")
        @Expose
        public Double pLN;
        @SerializedName("RON")
        @Expose
        public Double rON;
        @SerializedName("RUB")
        @Expose
        public Double rUB;
        @SerializedName("SEK")
        @Expose
        public Double sEK;
        @SerializedName("SGD")
        @Expose
        public Double sGD;
        @SerializedName("THB")
        @Expose
        public Double tHB;
        @SerializedName("TRY")
        @Expose
        public Double tRY;
        @SerializedName("USD")
        @Expose
        public Double uSD;
        @SerializedName("ZAR")
        @Expose
        public Double zAR;
    }

Optimal RealmSchema is

    public class Rate extends RealmObject {
        @PrimaryKey
        private String dateAndBaseAndRate; // example "2017-01-20-EUR-ZAR"

        @Index        
        private String base;

        @Index
        private Date date;

        @Index
        private String otherRate; // not Rate class

        private double value;

        // getters setters
    }

And you define a mapping between them.

I do not see the problem.

You are completely right the problem was in me and my code! I manage to fix everything now and get how exactly realm works, but still there is no available method to check your realm db that i found so far.

@Zhuinden did you manage to find anything that works with the latest libs?

@nikiizvorski only one I know is stetho-realm 2.0.0, but if I know right for whatever unknown reason it only works if default.realm exists.

@zaki50 What is the status on this?

At this moment it doesn't work with Realm version 3.1.2 and Realm-Stetho 2.0.0.

its working here. do you use a custom realm db filename? if so, try changing it to "default.realm"

@mlostekk Yes, I use. I updated Realm from 1.1.0 to 3.1.2 (Realm-Stetho 0.9.0) and on previous version it worked fine with custom filename.

Did you try simply to rename it to default.realm?

@mlostekk Yes, it works. But it sounds rather like workaround than fix of the issue.

according to code it should work if you give a name in the format of whatever.realm because default is Pattern.compile(".+\\.realm");, but it seems to me that you can configure this with a databaseNamePattern using RealmInspectorModulesProvider.ProviderBuilder

@mkovalyk yep, of course. This is only a workaround. I am having the same issue and found this as the only solution for now

@Zhuinden It should but doesn't. I have set databaseNamePattern. On previous version it worked. Actually it detects this database, but cannot find any tables.

@mkovalyk based on this commit that fixed it, the bug seems to have been something stupid.

Currently 3.7.1 has changed LinkView to OsList though.

➤ Christan Melchior commented:

Closing as outdated.

Was this page helpful?
0 / 5 - 0 ratings