Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stetho-realm can't debug realm #21

Open
HuuNguyen312 opened this issue May 22, 2016 · 10 comments
Open

stetho-realm can't debug realm #21

HuuNguyen312 opened this issue May 22, 2016 · 10 comments

Comments

@HuuNguyen312
Copy link

I can't debug realm using stetho-realm
Web SQL - Empty

capture

My build.gradle:

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}

}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
maven { url 'https://maven.fabric.io/public' }
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'
compile 'com.facebook.stetho:stetho-okhttp3:1.3.1'
}

MyApplication:
public void onCreate() {
super.onCreate();
configureJobManager();
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
// Set up Crashlytics, disabled for debug builds
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit, new TwitterCore(authConfig), new Digits());

    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(RealmInspectorModulesProvider.builder(this)
                            .build())
                    .build());
}
@HuuNguyen312
Copy link
Author

@QuynhND
Copy link

QuynhND commented Jun 1, 2016

I'm using Genymotion, same result, blank WebSQL

@HuuNguyen312
Copy link
Author

@QuynhND:
Tôi đã giải quyết được vấn đề này:
Bạn gọi Stetho.initialize... sau khi đã config xong Realm

VD:
RealmConfiguration realmConfig = new RealmConfiguration.Builder(context).build();
Realm.setDefaultConfiguration(realmConfig);

Stetho.initialize(
Stetho.newInitializerBuilder(BlinkApplication.context)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(BlinkApplication.context))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(BlinkApplication.context).build())
.build());

@QuynhND
Copy link

QuynhND commented Jun 2, 2016

@ngochuu90
Cảm ơn bạn đã gợi ý, nhưng tôi sử dụng Realm 1.0 vẫn không thấy kết quả. Bạn đang sử dụng Realm version nào?
Tôi đã thử trong cả application và mainActivity nhưng không thành công!

@HuuNguyen312
Copy link
Author

@QuynhND:

Tôi cũng đang sử dụng Realm 1.0. Nếu realm default không được, bạn thử set myconfig

RealmConfiguration myConfig = new RealmConfiguration.Builder(mcontext)
.name("Test.realm)
.schemaVersion(0)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(myConfig );

.enableWebKitInspector(RealmInspectorModulesProvider.builder(BlinkApplication.context).build()) sẽ khởi tạo các bảng, cột theo database realm của bạn

Khi database chưa được set xong, websql sẽ bị trắng

Bạn cũng có thể thử kill App hoàn toàn, sau đó chạy App, rồi bật lại chrome://inspect/#devices

@AndreiD
Copy link

AndreiD commented Jun 8, 2016

too hard to speak in English ?

@KimoAlem
Copy link

KimoAlem commented Aug 1, 2016

Really :(

@zaki50
Copy link
Member

zaki50 commented Oct 3, 2016

Are you using default database name (default.realm)?

@luckybk93
Copy link

luckybk93 commented Feb 20, 2017

To solove this problem.

Uninstall your app.
Remove .name("yourname.realm") in RealmConfiguration.Builder()
Re install.
My configuration:
AppController:
Realm.init(this);
byte[] key = new byte[64];
RealmConfiguration config = new RealmConfiguration.Builder()
// .name("yourname.realm")
// .encryptionKey(key)
.schemaVersion(4)
.deleteRealmIfMigrationNeeded()
.modules(Realm.getDefaultModule())
.build();
// Use the config
Realm.setDefaultConfiguration(config);
Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build());
Gradle
-> maven {url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'}
-> compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.uphyca:stetho_realm:2.0.0'

@chen-TeamNails
Copy link

RealmInspectorModulesProvider.builder(this)
.databaseNamePattern(Pattern.compile(".+\.realm"))
.build()
if you define the file's name , using " .databaseNamePattern(Pattern.compile(".+\.realm"))" could identify database file's name. or --->default.realm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants