How can I use ORMLite with SQLCipher together in Android?

前端 未结 5 2172
轻奢々
轻奢々 2020-12-05 15:12

I would like to use OrmLite with SQLCipher in my Android project, but both libraries have their own abstract SQLiteOpenHelper class to implement. Java don\'t a

5条回答
  •  無奈伤痛
    2020-12-05 15:38

    Applying the patch supplied by ge0rg I to found that queryForAll() throws a NoSuchMethod exception. After some investigation I discovered this is a result of rawQuery returning a net.sqlcipher.Cursor and the cursor returned by getQuery (in AndroidCompiledStatement) being an android.database.Cursor. I simply modified AndoridCompiledStatement's imports to:

    import net.sqlcipher.Cursor;
    

    And modified getCursor() to return a android.database.Cursor:

    public android.database.Cursor getCursor() { ...
    

    With these changes it appears to work for me. Though I'll need to play about a bit more to be completely sure.

提交回复
热议问题