Sam Sam - 1 month ago 21
Android Question

io.realm.exceptions.RealmException: Could not find io.realm.XRRealmModuleMediator

I've tried to add this plugin to my project.

Everytime I try to add it, I get this runtime error:

java.lang.RuntimeException: Unable to create application com.xcify.isap.xrwarehouse.XRWarehouseApp: io.realm.exceptions.RealmException: Could not find io.realm.XRRealmModuleMediator

Here is my gradle:

apply plugin: ''
apply plugin: 'realm-android'

repositories {
maven {
url ''
maven {
url ""

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
applicationId "com.isap.xrwarehouse"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"

testInstrumentationRunner ""
multiDexEnabled true
buildTypes {
debug {
debuggable true
minifyEnabled false
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
dataBinding {
enabled = true
lintOptions {
abortOnError false

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('', {
exclude group: '', module: 'support-annotations'
compile ''
compile ''
compile 'com.journeyapps:zxing-android-embedded:3.0.3@aar'
compile ''
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'com.uphyca:stetho_realm:2.1.0'

compile project(':swipe-button') //this is the problem library
compile project(':libs:xrappdb')
testCompile 'junit:junit:4.12'

I have also attached the library here. I've tried to clean the project, restart the Android studio (also using Invalidate and Restart), but none work.

Any idea? Please help.



It worked on Android 5 (Marshmallow), but doesn't work on Android Kit Kat. It also doesn't work on my nox emulator which is Android Kit Kat. Any idea why?

Answer Source

If you have

multiDexEnabled true

Then for Android 4.4 or lower, you also need to do

public class MyApplication extends MultiDexApplication { // <--

And in AndroidManifest.xml

<application name=".MyApplication"