-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
Goal
> Prevent the crash.
Expected Results
> Doesn't crash.
Actual Results
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/com.app.view.activity.MainActivity}: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.app/files/data.realm': Bad Realm file header (#3). (Bad Realm file header (#3)) (/data/data/com.app/files/data.realm) in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 Kind: ACCESS_ERROR. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.app/files/data.realm': Bad Realm file header (#3). (Bad Realm file header (#3)) (/data/data/com.app/files/data.realm) in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(OsSharedRealm.java) at io.realm.internal.OsSharedRealm.(OsSharedRealm.java) at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:254) at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:244) at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:319) at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:282) at io.realm.Realm.getInstance(Realm.java:353) at com.app.di.NetModule.provideDataRealm(NetModule.java:99) at com.app.di.NetModule_ProvideDataRealmFactory.get(NetModule_ProvideDataRealmFactory.java:28) at com.app.di.NetModule_ProvideDataRealmFactory.get(NetModule_ProvideDataRealmFactory.java:10) at dagger.internal.DoubleCheck.get(DoubleCheck.java:47) at com.app.di.NetModule_ProvideRealmControllerFactory.get(NetModule_ProvideRealmControllerFactory.java:31) at com.app.di.NetModule_ProvideRealmControllerFactory.get(NetModule_ProvideRealmControllerFactory.java:10) at dagger.internal.DoubleCheck.get(DoubleCheck.java:47) at com.app.di.DaggerNetComponent.injectMainActivity(DaggerNetComponent.java:195) at com.app.di.DaggerNetComponent.inject(DaggerNetComponent.java:95) at com.app.view.activity.MainActivity.dataInitialization(MainActivity.java:707) at com.app.view.activity.MainActivity.onCreate(MainActivity.java:169) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Steps & Code to Reproduce
Can't reproduce. Happens to some users. Getting this from Fabric:
Samsung S5 - 6.0.1
Canvas Nitro - 4.4.2
Code Sample
Relevant code according to the stack trace. I'm injecting Realm via Dagger like so:
Realm provideDataRealm(Application application) { Realm.init(application); RealmConfiguration realmConfig = new RealmConfiguration.Builder() .name("data.realm") .schemaVersion(Constants.SCHEMA_VERSION) .migration(new Migration()) .build(); return Realm.getInstance(realmConfig); }
Version of Realm and tooling
Realm version(s): 4.3.1
Realm sync feature enabled: no
Android Studio version: 3.0.1
Which Android version and device:
Samsung S5 - 6.0.1
Canvas Nitro - 4.4.2