realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Some classes are missing from the schema for this Realm.

Open dalinaum opened this issue 10 years ago • 11 comments

@rfrost77's sent some Crashlyctics reports.

Goal

Do not encountered the following error.

Expected Results

Works well.

Actual Results

Some classes are missing from the schema for this Realm.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{kr.co.rememberapp/kr.co.rememberapp.activity.home.SplashActivity}: io.realm.exceptions.RealmMigrationNeededException: The CardCustomDataRealm class is missing from the schema for this Realm.
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3149)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3248)
       at android.app.ActivityThread.access$1000(ActivityThread.java:197)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1681)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6872)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by io.realm.exceptions.RealmMigrationNeededException: The CardCustomDataRealm class is missing from the schema for this Realm.
       at io.realm.CardCustomDataRealmRealmProxy.validateTable(CardCustomDataRealmRealmProxy.java:197)
       at io.realm.DefaultRealmModuleMediator.validateTable(DefaultRealmModuleMediator.java:139)
       at io.realm.Realm.initializeRealm(Realm.java:315)
       at io.realm.Realm.createAndValidate(Realm.java:283)
       at io.realm.Realm.createInstance(Realm.java:262)
       at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:114)
       at io.realm.Realm.getDefaultInstance(Realm.java:195)
       at kr.co.rememberapp.activity.BaseActivity.initialize(BaseActivity.java:121)
       at kr.co.rememberapp.activity.BaseActivity.onCreate(BaseActivity.java:115)
       at kr.co.rememberapp.activity.home.SplashActivity.onCreate(SplashActivity.java:38)
       at android.app.Activity.performCreate(Activity.java:6550)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3102)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3248)
       at android.app.ActivityThread.access$1000(ActivityThread.java:197)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1681)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6872)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

See also their Crashlyctics:

  • http://crashes.to/s/d2e9b8ba60e
  • http://crashes.to/s/13214a08e44
  • http://crashes.to/s/f0ac7e1b20c

Steps & Code to Reproduce

They are only reported by Crashlyctics.

Version

Which Android version and device: 4, 5, 6

dalinaum avatar Apr 08 '16 08:04 dalinaum

@rfrost77 Is is possible that some devices have upgraded the app, and that you added a number of classes and didn't write a migration step?

kneth avatar Apr 11 '16 07:04 kneth

@dalinaum @rfrost77 Did you solve the issue? Or can you provide an example to reproduce the issue?

kneth avatar Apr 19 '16 09:04 kneth

Closing due to no response

cmelchior avatar May 03 '16 20:05 cmelchior

I meet the same problem, if you solve, please tell me , thank you in advance!

hjmJhon avatar Apr 25 '17 23:04 hjmJhon

I've seen this issue caused by the broken memcpy function before 3.1.1, but otherwise it means the migration didn't run right, or a migration was not added even though it should have been.

Zhuinden avatar Apr 26 '17 07:04 Zhuinden

@hjmJhon Which device and Android version do you experience this on?

kneth avatar Apr 26 '17 09:04 kneth

Clearing the app data worked for me!

Manhazito avatar May 04 '17 16:05 Manhazito

@kneth @hjmJhon I just got the same issue on a Samsung Note 5 running 7.0. I added all three of these classes at the same time (all extend RealmObject). From my understanding, Realm creates the table for new classes automatically with a bump of the schema version, and a custom migration is only needed if fields are changing within already created tables. It's complaining that there's no table for GenerationAbility.

public class Ability extends RealmObject {

   private String name;
   private RealmList<EffectEntry> effect_entries;
   private GenerationAbility generation;
}

ozv101 avatar May 13 '17 14:05 ozv101

Realm creates the table for new classes automatically with a bump of the schema version

Only in Sync mode.

Otherwise you must specify a migration yourself and add the new classes/fields to the schema yourself through the DynamicRealm API (provided in the migration).

Zhuinden avatar Jun 13 '17 07:06 Zhuinden

Caused by: io.realm.exceptions.RealmMigrationNeededException: The 'ModelItems' class is missing from the schema for this Realm. I have this problem while running.

ameersabith avatar Aug 18 '17 12:08 ameersabith

@ameersabith you need to define a migration if you add new classes etc (in non-sync realm)

Zhuinden avatar Aug 18 '17 13:08 Zhuinden