title: IllegalArgumentException: XXX is not part of the schema for this Realm
body: <p>I have IllegalArgumentException each time i start my first application with realm. My application never worked. I read a lot trying to solve my problem and I did a lot of changes.</p>
  
  <p><strong>Android-Studio configurations:</strong></p>
  
  <ul>
  <li><p>Annotation enabled</p></li>
  <li><p>Instant run disabled</p></li>
  </ul>
  
  <p><strong>Build.gradle config:</strong></p>
  
  <ul>
  <li><p>realm version 2.2.1</p></li>
  <li><p>sdk version 25</p></li>
  <li><p>I have apply plugin: 'com.android.application' 'realm-android' 'android-apt' and 'android-command'</p></li>
  <li><p>I have dexOptions incremental false</p></li>
  </ul>
  
  <p><strong>Inside my application i have</strong></p>
  
  <pre><code>Realm.init(this);
  </code></pre>
  
  <p><strong>I write migration code</strong></p>
  
  <pre><code>public class Migration implements RealmMigration {
  
      @Override
      public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
          RealmSchema schema = realm.getSchema();
          if(newVersion == 0){
              oldVersion++;
          }
          if(!schema.contains("ItemCatalog")){
              schema.create("ItemCatalog")
                      .addField("id",Integer.class)
                      .addField("tab",Integer.class)
                      .addField("image", byte[].class)
                      .addField("title",String.class)
                      .addField("description",String.class)
                      .addPrimaryKey("id");
          }
      }
  }
  </code></pre>
  
  <p><strong>Inside my first activity i have</strong></p>
  
  <pre><code>RealmConfiguration config = new RealmConfiguration.Builder().migration(new Migration())
                  .schemaVersion(0)
                  .name("appVenture.realm").build();
          Realm.setDefaultConfiguration(config);
  </code></pre>
  
  <p><strong>Inside my D.T.O.object i have</strong></p>
  
  <pre><code>import io.realm.RealmObject;
  import io.realm.annotations.PrimaryKey;
  import io.realm.annotations.RealmClass;
  
  @RealmClass
  public class ItemCatalog extends RealmObject{
  
      @PrimaryKey
      private Integer id = null;
      private Integer tab = null;
      private byte[] image = null;
      private String title = null;
      private String description = null;
  
  //.. auto-generated getters and setters here
  }
  </code></pre>
  
  <p><strong>My Big Exception is</strong></p>
  
  <blockquote>
    <p>E/AndroidRuntime: FATAL EXCEPTION: main
                      Process: com.example.francisco.helloworld, PID: 1646
                      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.francisco.helloworld/com.example.francisco.helloworld.MainActivity}:
    java.lang.IllegalArgumentException: ItemCatalog is not part of the
    schema for this Realm
                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2319)
                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2370)
                          at android.app.ActivityThread.access$800(ActivityThread.java:155)
                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
                          at android.os.Handler.dispatchMessage(Handler.java:102)
                          at android.os.Looper.loop(Looper.java:136)
                          at android.app.ActivityThread.main(ActivityThread.java:5426)
                          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:1268)
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
                          at dalvik.system.NativeStart.main(Native Method)
                       Caused by: java.lang.IllegalArgumentException: ItemCatalog is not part of the schema for this Realm
                          at io.realm.internal.modules.CompositeMediator.getMediator(CompositeMediator.java:172)
                          at io.realm.internal.modules.CompositeMediator.getTableName(CompositeMediator.java:90)
                          at io.realm.RealmSchema.getTable(RealmSchema.java:296)
                          at io.realm.Realm.createObjectInternal(Realm.java:817)
                          at io.realm.Realm.createObject(Realm.java:801)
                          at com.example.francisco.helloworld.data.RealmController$1.execute(RealmController.java:72)
                          at io.realm.Realm.executeTransaction(Realm.java:1253)
                          at com.example.francisco.helloworld.data.RealmController.saveCatalog(RealmController.java:69)
                          at com.example.francisco.helloworld.data.RealmController.saveCatalog(RealmController.java:64)
                          at com.example.francisco.helloworld.MainActivity.onCreate(MainActivity.java:67)
                          at android.app.Activity.performCreate(Activity.java:5296)
                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2283)
                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2370) 
                          at android.app.ActivityThread.access$800(ActivityThread.java:155) 
                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243) 
                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                          at android.os.Looper.loop(Looper.java:136) 
                          at android.app.ActivityThread.main(ActivityThread.java:5426) 
                          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:1268) 
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) 
                          at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>
  
  <p>I spent 3 days trying to solve this.</p>
  
  <p>Thank you in advance.</p>
  
  <p>Best Regards.</p>