2

Before implementing Realm in my Android application the launch time was less than 2 seconds, but after implementing it the minimum launch time is 8 seconds and maximum launch time is 6 minutes.

I am using only 3 tables with Realm. Is there any setting or configuration required for this?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
  • Do you have a class that extends `Application`, if yes can you add it. Or how you init `Realm` config. And one more question what you mean about launching (your building project process takes so many time or you see white screen on app start) And did you tried by disabling instant run ? – Yasin Kaçmaz Aug 01 '16 at 14:41
  • The first Realm instance takes a bit time to init the schemas, but 3 tables should never take 8 secs - 6 minutes. Could you please do some profiling to see which part takes time? – beeender Aug 02 '16 at 02:18
  • @YasinKaçmaz, I do have class that extends Application but I didn't put any kind of code their related to Realm. I have below lines of code in activity to initialize the realm 'try { realmConfig = new RealmConfiguration.Builder(getActivity()).build(); realm = Realm.getInstance(realmConfig); } catch (RealmMigrationNeededException e){ try { Realm.deleteRealm(realmConfiguration); //Realm file has been deleted. return Realm.getInstance(realmConfiguration); } catch (Exception ex){ ex.printStackTrace(); //No Realm file to remove. } }' – Ajay Sharma Aug 03 '16 at 07:50
  • If `catch (RealmMigrationNeededException e)` is just for testing purpose, you can use `RealmConfiguration.Builder.deleteIfMigrationNeeded()` instead. – beeender Aug 08 '16 at 08:36
  • Do you call `Realm.compactRealm()` on initialization or something? – EpicPandaForce Aug 09 '16 at 13:27
  • @AjaySharma Have you find any solution to reduce compilation time? I am facing same problem. It takes 8 to 10 mins to build. – Nik Jul 09 '18 at 10:36

0 Answers0