{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1581","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1581/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1581/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1581/events","html_url":"https://github.com/realm/realm-java/issues/1581","id":110936923,"number":1581,"title":"Illegal Argument Exception encountered when compressing a Realm file created by version 0.83.0","user":{"login":"creativepsyco","id":547235,"avatar_url":"https://avatars.githubusercontent.com/u/547235?v=3","gravatar_id":"","url":"https://api.github.com/users/creativepsyco","html_url":"https://github.com/creativepsyco","followers_url":"https://api.github.com/users/creativepsyco/followers","following_url":"https://api.github.com/users/creativepsyco/following{/other_user}","gists_url":"https://api.github.com/users/creativepsyco/gists{/gist_id}","starred_url":"https://api.github.com/users/creativepsyco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/creativepsyco/subscriptions","organizations_url":"https://api.github.com/users/creativepsyco/orgs","repos_url":"https://api.github.com/users/creativepsyco/repos","events_url":"https://api.github.com/users/creativepsyco/events{/privacy}","received_events_url":"https://api.github.com/users/creativepsyco/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/bug","name":"bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-12T09:14:55Z","updated_at":"2015-10-16T03:27:39Z","closed_at":"2015-10-15T18:55:10Z","body":"Hi peeps,\r\n\r\nI am currently running into an `IllegalArgumentException` indicating that the format of the Realm file is invalid when I am trying to call `Realm.compactRealm(realmConfiguration...)` before I use the realm file.\r\n\r\nI have a sample project to demonstrate the crash here: https://github.com/creativepsyco/sample-realm-crash/\r\n\r\nEssentially I am trying to compact the realm file before it is ever used in the app.\r\n\r\nSteps to reproduce:\r\n1. Clone the project from https://github.com/creativepsyco/sample-realm-crash/\r\n2. Compile and run. It will not crash because realm version is `0.82.2`\r\n3. Now in `build.gradle` edit the version to `0.83.0`\r\n4. Compile and run the app. \r\n5. It crashes with the stack trace:\r\n```\r\n FATAL EXCEPTION: main\r\n Process: mohitkanwal.com.examplerealm, PID: 28687\r\n java.lang.RuntimeException: Unable to start activity\r\nComponentInfo{mohitkanwal.com.examplerealm/mohitkanwal.com.examplerealm.MainActivity}:\\\r\njava.lang.IllegalArgumentException: Illegal Argument: Invalid format of Realm file.\r\n     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3119)\r\n     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)\r\n     at android.app.ActivityThread.access$1000(ActivityThread.java:198)\r\n     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)\r\n     at android.os.Handler.dispatchMessage(Handler.java:102)\r\n     at android.os.Looper.loop(Looper.java:145)\r\n     at android.app.ActivityThread.main(ActivityThread.java:6837)\r\n     at java.lang.reflect.Method.invoke(Native Method)\r\n     at java.lang.reflect.Method.invoke(Method.java:372)\r\n     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)\r\n     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)\r\n  Caused by: java.lang.IllegalArgumentException: Illegal Argument: Invalid format of Realm file.\r\n     at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method)\r\n     at io.realm.internal.SharedGroup.<init>(SharedGroup.java:68)\r\n     at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49)\r\n     at io.realm.BaseRealm.<init>(BaseRealm.java:87)\r\n     at io.realm.Realm.<init>(Realm.java:151)\r\n     at io.realm.Realm.createAndValidate(Realm.java:279)\r\n     at io.realm.Realm.create(Realm.java:247)\r\n     at io.realm.Realm.getInstance(Realm.java:219)\r\n     at mohitkanwal.com.examplerealm.ContactHelper.getMeARealmFile(ContactHelper.java:53)\r\n     at mohitkanwal.com.examplerealm.ContactHelper.getAllContacts(ContactHelper.java:64)\r\n     at mohitkanwal.com.examplerealm.MainActivity.onCreate(MainActivity.java:25)\r\n     at android.app.Activity.performCreate(Activity.java:6500)\r\n     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)\r\n     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)\r\n     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218) \r\n```\r\n\r\nIs the `SharedGroupManager.compact()` implementation compatible with the new format of the Realm File? Right now it seems to be unusable with any Realm created by `v0.83` or `v0.82.2` \r\n\r\nRegards\r\nMohit\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/148589157","html_url":"https://github.com/realm/realm-java/issues/1581#issuecomment-148589157","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1581","id":148589157,"user":{"login":"creativepsyco","id":547235,"avatar_url":"https://avatars.githubusercontent.com/u/547235?v=3","gravatar_id":"","url":"https://api.github.com/users/creativepsyco","html_url":"https://github.com/creativepsyco","followers_url":"https://api.github.com/users/creativepsyco/followers","following_url":"https://api.github.com/users/creativepsyco/following{/other_user}","gists_url":"https://api.github.com/users/creativepsyco/gists{/gist_id}","starred_url":"https://api.github.com/users/creativepsyco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/creativepsyco/subscriptions","organizations_url":"https://api.github.com/users/creativepsyco/orgs","repos_url":"https://api.github.com/users/creativepsyco/repos","events_url":"https://api.github.com/users/creativepsyco/events{/privacy}","received_events_url":"https://api.github.com/users/creativepsyco/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T03:27:39Z","updated_at":"2015-10-16T03:27:39Z","body":":+1: Verified and it works."}}