not crash
12-07 13:32:04.408 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.ImmutableRealmSchema', referenced from method io.realm.Realm.
12-07 13:32:04.418 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.internal.OsSchemaInfo', referenced from method io.realm.Realm.createExpectedSchemaInfo
12-07 13:32:04.418 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.getDefaultModule
12-07 13:32:04.418 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.getDefaultModule
12-07 13:32:04.418 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.getDefaultModule
12-07 13:32:04.428 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.Realm$3', referenced from method io.realm.Realm.getGlobalInstanceCount
12-07 13:32:04.428 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.RealmModel', referenced from method io.realm.Realm.copyFromRealm
12-07 13:32:04.428 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.RealmModel', referenced from method io.realm.Realm.copyToRealm
12-07 13:32:04.438 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.RealmModel', referenced from method io.realm.Realm.copyToRealmOrUpdate
12-07 13:32:04.438 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createAllFromJson
12-07 13:32:04.438 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createAllFromJson
12-07 13:32:04.438 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createObjectFromJson
12-07 13:32:04.438 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createObjectFromJson
12-07 13:32:04.448 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createOrUpdateAllFromJson
12-07 13:32:04.448 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createOrUpdateAllFromJson
12-07 13:32:04.448 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createOrUpdateAllFromJson
12-07 13:32:04.448 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createOrUpdateObjectFromJson
12-07 13:32:04.448 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createOrUpdateObjectFromJson
12-07 13:32:04.448 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.exceptions.RealmException', referenced from method io.realm.Realm.createOrUpdateObjectFromJson
12-07 13:32:04.478 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.BaseRealm$1', referenced from method io.realm.BaseRealm.
12-07 13:32:04.478 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.BaseRealm$1', referenced from method io.realm.BaseRealm.
12-07 13:32:04.478 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.BaseRealm$6', referenced from method io.realm.BaseRealm.createMigrationCallback
12-07 13:32:04.478 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.BaseRealm$4', referenced from method io.realm.BaseRealm.deleteRealm
12-07 13:32:04.488 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.RealmObjectSchema', referenced from method io.realm.BaseRealm.deleteAll
12-07 13:32:04.498 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.DynamicRealmObject', referenced from method io.realm.BaseRealm.get
12-07 13:32:04.508 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.DynamicRealmObject', referenced from method io.realm.BaseRealm.get
12-07 13:32:04.518 14839-14839/sheng.com.scandroiddemo E/dalvikvm: Could not find class 'io.realm.BaseRealm$3', referenced from method io.realm.BaseRealm.stopWaitForChange
12-07 13:32:04.528 14839-14839/sheng.com.scandroiddemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: sheng.com.scandroiddemo, PID: 14839
java.lang.NoClassDefFoundError: io.realm.internal.async.RealmThreadPoolExecutor
at io.realm.BaseRealm.(BaseRealm.java:72)
at sheng.com.scandroiddemo.MyApplication.onCreate(MyApplication.java:17)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4438)
at android.app.ActivityThread.access$1500(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5111)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
public class MyApplication extends Application{
@Override
public void onCreate() {
super.onCreate();
Realm.init(this);
}
}
Realm version(s):4.3.0
Realm sync feature enabled: no
Android Studio version: 3.0
Which Android version and device: 4.4
Do you have multiDexEnabled true in your build.gradle?
Because if yes, then you should be extends MultiDexApplication instead of extends Application.
It can run normally, thank you. @Zhuinden
@Zhuinden your solution is working fine, thanks for saving my day.
Most helpful comment
Do you have
multiDexEnabled truein yourbuild.gradle?Because if yes, then you should be
extends MultiDexApplicationinstead ofextends Application.