eggheadgames / android-realm-asset-helper Goto Github PK
View Code? Open in Web Editor NEWA small library to help with Realm.IO integration in Android apps
License: MIT License
A small library to help with Realm.IO integration in Android apps
License: MIT License
When trying to read a realm file in a blank android project following the description in the readme.md I get the following error
Caused by: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/myapp/files/default.realm': Unsupported Realm file format version (11)
I have the following questions:
I assume the (11) represents the version of the database file that I supply, correct?
Which database versions is the android-realm-asset-helper compatible with. Is my file too old or too new?
I'll be glad for any help :)
Some device crashed when loading the database during application onCreate.
Any idea?
Fatal Exception: java.lang.OutOfMemoryError at com.eggheadgames.realmassethelper.OsUtil.loadDatabaseToLocalStorage(Unknown Source) at com.eggheadgames.realmassethelper.RealmAssetHelper.getInstance(Unknown Source) at com.myapp.MyAppApplication.onCreate(Unknown Source) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4218) at android.app.ActivityThread.access$1300(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1275) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4812) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) at dalvik.system.NativeStart.main(NativeStart.java)
Let's get the full lint, PMD and SpotBugs (FindBugs) checking running, like we do on our other projects.
Doesn't compile, error:
Cannot resolve symbol realmConfig
Realm v 2.3.2
Looks like the code should look like that:
Realm.init(this);
RealmAssetHelper.getInstance(this).loadDatabaseToStorage("data", "defaultpacked", new IRealmAssetHelperStorageListener() {
@Override
public void onLoadedToStorage(String realmDbName, RealmAssetHelperStatus status) {
RealmConfiguration realmConfig = new RealmConfiguration.Builder()
.name(realmDbName)
.build();
Realm realm = Realm.getInstance(realmConfig);
}
});
I put my test.realm in assets folder /data/test.realm
RealmAssetHelper.getInstance(this).loadDatabaseToStorage("data", "test.realm", new
IRealmAssetHelperStorageListener() {
@Override
public void onLoadedToStorage(String realmDbName, RealmAssetHelperStatus status) {
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(MainActivity.this)
.name(realmDbName)
.build();
realm = Realm.getInstance(realmConfiguration);
}
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.