How to package a realm database on react native app


(Techday) #1

Hi, I have a realm database with a lot of data. I need to know how can I pre-package the realm database with my react-native app. I try to put the realm file (default.realm) in the follow root:

/android/app/src/main/assets

and then in the constructor call this function:

Realm.copyBundledRealmFiles();

but it always shows 0 items. Anyone knows how to do it?

Thanks!


(Kenneth Geisshirt) #2

If you create your bundle using Gradle, make sure that your gradle.properties doesn’t have org.gradle.configureondemand=true (see also https://facebook.github.io/react-native/docs/signed-apk-android.html#generating-the-release-apk).