Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.eikaramba:stetho-realm:0.8.1'
}
dependencies {
implementation("com.github.eikaramba:stetho-realm:0.8.1")
}
<dependency>
<groupId>com.github.eikaramba</groupId>
<artifactId>stetho-realm</artifactId>
<version>0.8.1</version>
</dependency>
libraryDependencies += "com.github.eikaramba" % "stetho-realm" % "0.8.1"
:dependencies [[com.github.eikaramba/stetho-realm "0.8.1"]]
Stetho-Realm is a Realm module for Stetho.
It displays Realm database content in Stetho instead of SQLite database content.
grab via Gradle:
repositories {
maven {
url 'https://github.com/eikaramba/stetho-realm/raw/master/maven-repo'
}
}
dependencies {
compile 'com.facebook.stetho:stetho:1.3.1'
compile 'com.uphyca:stetho_realm:0.9.0'
}
Stetho-Realm supports Stetho 1.3.1 or newer and Realm 1.1.0 or newer.
In your Application
class, please initialize Stetho with RealmInspectorModulesProvider.ProviderBuilder
as follows.
RealmInspectorModulesProvider.ProviderBuilder
replaces SQLite module with Realm module.
You can use RealmInspectorModulesProvider.ProviderBuilder#baseProvider(InspectorModulesProvider)
in order to customized InspectorModulesProvider
instead of default provider.
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build());
//------ init the db afterwards (just an example) ----------------
RealmConfiguration config = new RealmConfiguration.Builder(this).deleteRealmIfMigrationNeeded().name("yourDB.realm").build();
Realm.setDefaultConfiguration(config);
}
}
By calling some methods in RealmInspectorModulesProvider.ProviderBuilder
,
you can include metadata table in table list, and can provide database file name pattern.
And also you can specify base folder for database files, encryption keys, limit, sort order.
RealmInspectorModulesProvider.builder(this)
.withFolder(getCacheDir()) //optional
.withEncryptionKey("encrypted.realm", key) //optional
.withMetaTables() //optional
.withDescendingOrder()
.withLimit(1000)
.databaseNamePattern(Pattern.compile(".+\\.realm"))
.build()
First try without optional methods
Add the following lines if you use proguard. You might already have the first line in your proguard file.
-keep class com.facebook.stetho.** { *; }
-keep class com.uphyca.** { *; }
http://littlerobots.nl/blog/stetho-for-android-debug-builds-only/
Stetho-Realm is BSD-licensed.