Sam
Sam

Reputation: 1908

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: 'com.android.application'
apply plugin: 'realm-android'

repositories {
    maven {
        url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
    }
    maven {
        url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

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

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.journeyapps:zxing-android-embedded:3.0.3@aar'
    compile 'com.google.zxing:core:3.2.0'
    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.

Thanks, Sam

UPDATE

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?

Upvotes: 0

Views: 824

Answers (1)

EpicPandaForce
EpicPandaForce

Reputation: 81539

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"

Upvotes: 2

Related Questions