Skip to content

Instantly share code, notes, and snippets.

@kiddouk
Last active August 29, 2015 14:27
Show Gist options
  • Save kiddouk/5a5d20b2e894335f4eac to your computer and use it in GitHub Desktop.
Save kiddouk/5a5d20b2e894335f4eac to your computer and use it in GitHub Desktop.
Crash on Realm on a clean install.
Public class Category extends RealmObject {
@PrimaryKey
private String title;
public String getTitle() { return title; }
public void setTitle(String t) { this.title = t; }
}
08-13 17:13:35.186 12274 12274 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{io.errorlab.slickbackgrounds/io.errorlab.slickbackgrounds.activities.MainActivity}: io.realm.exceptions.RealmMigrationNeededException: RealmMigration must be provided
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5415)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: Caused by: io.realm.exceptions.RealmMigrationNeededException: RealmMigration must be provided
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.realm.Realm.migrateRealm(Realm.java:1651)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.realm.Realm.migrateRealm(Realm.java:1636)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.realm.Realm.create(Realm.java:569)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.realm.Realm.getInstance(Realm.java:411)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.realm.Realm.getInstance(Realm.java:368)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.realm.Realm.getInstance(Realm.java:349)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at io.errorlab.slickbackgrounds.activities.MainActivity.onCreate(MainActivity.java:77)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6162)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
08-13 17:13:35.186 12274 12274 E AndroidRuntime: ... 9 more
public class Wallpaper extends RealmObject {
@PrimaryKey
private String id;
private String title;
private int price;
private String author;
private String category;
private String thumbnail;
private String preview;
private String crop;
private int width;
private int height;
public String getId() { return id; };
public void setId(String id) { this.id = id; };
public String getTitle() { return title; };
public void setTitle(String title) { this.title = title; }
public int getPrice() { return price; };
public void setPrice(int p) { this.price = p; }
public String getAuthor() { return author; }
public void setAuthor(String s) { this.author = s; }
public String getCategory() { return category; }
public void setCategory(String c) { this.category = c; }
public String getThumbnail() { return thumbnail; }
public void setThumbnail(String t) { this.thumbnail = t; }
public String getPreview() { return preview; }
public void setPreview(String p) { this.preview = p; }
public String getCrop() { return crop; }
public void setCrop(String c) { this.crop = c; }
public int getWidth() { return width; }
public void setWidth(int w) { this.width = w; }
public int getHeight() { return height; }
public void setHeight(int h) { this.height = h; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment