问题描述
我使用了db4o在一个小项目,在Android 2.2,2.3,等的伟大工程在蜂窝,然而,数据库初始化会导致以下错误:
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'
这强制关闭和错误发生在既有的Xoom运行的蜂窝和Galaxy Tab的运行蜂窝。
This force close and the error occur on both a Xoom running Honeycomb and a Galaxy Tab running Honeycomb.
相关code是:
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;
}
是否有蜂窝处理其外部文件系统的方式有些区别?有什么我可以在db4oDBFullPath()方法来更改,这将使这两个兼容?我真的很茫然,什么发生的事情那是不同的。也许有,我需要启用一些蜂窝特定的权限?
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/博客/ db4o的/ tabid / 197 /的EntryID / 1057 / Default.aspx的
这篇关于db4o中的蜂窝Db4oException:文件格式不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!