realm-java: Realm 4.3.1 ClassNotFoundException: Didn't find class "io.realm.internal.async.RealmThreadPoolExecutor"
Goal
Setup realm
Expected Results
Realm configured
Actual Results
12-08 09:26:29.513 8300-8300/com.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app, PID: 8300
java.lang.NoClassDefFoundError: Failed resolution of: Lio/realm/internal/async/RealmThreadPoolExecutor;
at io.realm.BaseRealm.<clinit>(BaseRealm.java:72)
at io.realm.Realm.init(Realm.java)
at com.app.controllers.MyApplication.setupRealm(MyApplication.java:142)
at com.app.controllers.MyApplication.onCreate(MyApplication.java:83)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5885)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1703)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.realm.internal.async.RealmThreadPoolExecutor" on path: DexPathList[[zip file "/data/app/com.app-2/base.apk"],nativeLibraryDirectories=[/data/app/com.app-2/lib/arm64, /data/app/com.app-2/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at io.realm.BaseRealm.<clinit>(BaseRealm.java:72)
at io.realm.Realm.init(Realm.java)
at com.app.controllers.MyApplication.setupRealm(MyApplication.java:142)
at com.app.controllers.MyApplication.onCreate(MyApplication.java:83)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5885)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1703)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Steps & Code to Reproduce
Describe your current debugging efforts.
Code Sample
Fails at Realm.init(this);, where this is instance of Application
private void setupRealm() {
Realm.init(this);
try {
RealmConfiguration newConfig = new RealmConfiguration.Builder().schemaVersion(2).deleteRealmIfMigrationNeeded().compactOnLaunch().build();
Realm.setDefaultConfiguration(newConfig);
} catch (RuntimeException ignore) {}
}
Version of Realm and tooling
Realm version(s): 4.3.1
Which Android version and device: Any
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (10 by maintainers)
I got java.lang.NoClassDefFoundError: io.realm.Realm during update gradle and other libs. Returning to stable gradle do the trick: Change classpath ‘com.android.tools.build:gradle:3.1.0-alpha06’ to classpath ‘com.android.tools.build:gradle:3.0.1’