I’m using db4o in a small project that works great on Android 2.2, 2.3, etc. On Honeycomb, however, database initialization results in the following error:
com.db4o.ext.Db4oException: File format incompatible: '/data/data/com.myapp/app_data/my_app.db4o'
This force close and the error occur on both a Xoom running Honeycomb and a Galaxy Tab running Honeycomb.
The relevant code is:
public ObjectContainer db() {
// Create, open, and close the database
try {
if (oc == null || oc.ext().isClosed()) {
oc = Db4oEmbedded
.openFile(dbConfig(), db4oDBFullPath(mContext));
}
return oc;
} catch (Exception e) {
Log.e(CFAApplication.TAG, e.toString());
return null;
}
}
private String db4oDBFullPath(Context ctx) {
// Returns the path for the database location
return ctx.getDir("data", 2) + "/" + "myapp.db4o";
}
public List<MyItem> getListItem(final String passedItemTitle) {
List<MyItem> result = db().query(new Predicate<MyItem>() { // Error occurs here
public boolean match(MyItem listItem) {
if (passedItemTitle.equals(listItem.getTitle())) {
return true;
}
return false;
}
});
return result;
}
Is there some difference in the way Honeycomb handles its external file system? Is there anything I can change in the db4oDBFullPath() method that would make the two compatible? I’m really at a loss as to what’s happening that’s different. Maybe there are some Honeycomb-specific permissions that I need to enable?
It’s been fixed in the latest release:
http://community.versant.com/Blogs/db4o/tabid/197/entryid/1057/Default.aspx