【问题标题】:Realm Migration for Column type long列类型 long 的领域迁移
【发布时间】:2015-11-20 06:31:58
【问题描述】:

我在RealmModel 类中创建了一个新的长字段,我必须迁移现有架构。但事实证明没有ColumnType.LONG。当我使用任何其他 ColumnType 我得到 -

JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x2e
11-20 11:55:40.019 17835-17952/com.my.app A/art: art/runtime/check_jni.cc:65]     string: 'Unrecoverable error. Failure when converting long string to UTF-16 error_code = 2; retcode = 0; StringData.size = 8188713; StringData.data = 

【问题讨论】:

    标签: android realm realm-migration


    【解决方案1】:

    底层存储引擎只有一个整数类型:ColumnType.INTEGER,它会自动适应输入的大小,所以使用它应该没问题。

    【讨论】:

    • 仍然出现同样的错误 - D/REALM: jni: ThrowingException 11, Failure when converting long string to UTF-16 error_code = 2; retcode = 0; StringData.size = 8188713;
    • 您得到的错误是关于字符串,而不是整数。您是否有机会处理包含字符串而不是整数的字段?
    • 我有一个现有的领域文件,我想在其中添加一列 Table wordTable = realm.getTable(WordModel.class); wordTable.addColumn(ColumnType.INTEGER, "timestringLong");,这是我在 WordModelprivate long timestringLong; 中添加的字段
    • 听起来不错。在 GitHub 上创建问题可能更容易,因此我们可以进一步调查:github.com/realm/realm-java/issues
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多