0

我刚刚升级到 SDK 1.7.7,我的应用程序无法再访问本地数据存储。我用谷歌搜索了一下,发现这通常发生在升级 SDK 时。

我似乎找不到任何可以让我保留现有数据的解决方案。我已经在我的数据存储中设置了大量不想重新创建的测试数据。有什么方法可以将本地数据存储中的数据从一个 SDK 版本转换/迁移到另一个版本?

4

1 回答 1

1

The steps I use are:

1) make a remote_api connection https://developers.google.com/appengine/articles/remote_api

something like

    static RemoteApiOptions options;
    options = new RemoteApiOptions().server("localhost", 8888).credentials("", ""); // password doesn't matter

    RemoteApiInstaller installer = new RemoteApiInstaller();
    installer.install(options);

2) fetch my data (this is for me with Objectify, but it'd be how you'd normally do it)

            UserDAO udao = new UserDAO(false);
            Query<UserOFY> qu = udao.ofy().query(UserOFY.class);

3) persist my data to the harddrive

something like

            FileOutputStream fileOut = new FileOutputStream(LOCAL_AE_BACKUPS_USER + "/" + USERS_FROM_LOCAL_BACKUP + "_" + u.getNickName());
            ObjectOutputStream out = new ObjectOutputStream(fileOut);
            out.writeObject(u);
            out.close();

then I just do the reverse after upgrading the version.

1) read the persisted data on my hard drive

2) make a connection to the local datastore

3) persist the data to the new version of the local datastore

于 2013-04-10T13:07:58.037 回答