SQLiteException: no column named forceReadOnly since update



  • Since i updated the app i cannot sync calender entries anymore. I did not sync contacts. I am getting the following exception:

    --- BEGIN DEBUG INFO ---
    Account name: cloud

    EXCEPTION:
    android.database.sqlite.SQLiteException: table collections has no column named forceReadOnly (code 1): , while compiling: INSERT OR REPLACE INTO collections(source,description,forceReadOnly,color,readOnly,url,supportsVTODO,displayName,serviceID,sync,type,timezone,supportsVEVENT) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:895)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:506)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
    at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
    at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469)
    at at.bitfire.davdroid.DavService$refreshCollections$$inlined$use$lambda$7.invoke(DavService.kt:236)
    at at.bitfire.davdroid.DavService.refreshCollections(DavService.kt:354)
    at at.bitfire.davdroid.DavService$onStartCommand$$inlined$let$lambda$1.invoke(DavService.kt:66)
    at at.bitfire.davdroid.DavService$onStartCommand$$inlined$let$lambda$1.invoke(DavService.kt:45)
    at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:18)

    SOFTWARE INFORMATION
    Package: at.bitfire.davdroid
    Version: 1.9.5-ose (192) from 02.12.2017
    Installed from: APK (directly)
    JB Workaround installed: no

    CONNECTIVITY (at the moment)
    Active connection: WiFi, CONNECTED

    CONFIGURATION
    android.permission.READ_CONTACTS permission: granted
    android.permission.WRITE_CONTACTS permission: granted
    android.permission.READ_CALENDAR permission: granted
    android.permission.WRITE_CALENDAR permission: granted
    org.dmfs.permission.READ_TASKS permission: denied
    org.dmfs.permission.WRITE_TASKS permission: denied
    System-wide synchronization: automatically
    Account: cloud
    Address book sync. interval: 240 min
    Calendar sync. interval: 240 min
    OpenTasks sync. interval: —
    WiFi only: false
    [CardDAV] Contact group method: CATEGORIES
    [CalDAV] Time range (past days): 90
    Manage calendar colors: true

    SQLITE DUMP
    android_metadata
    | locale |
    | de_DE |

    services
    | _id | accountName | service | principal |
    | 1 | cloud | carddav | XXXXX |
    | 2 | cloud | caldav | XXXXX |

    sqlite_sequence
    | name | seq |
    | services | 2 |
    | homesets | 5 |
    | collections | 17 |

    homesets
    | _id | serviceID | url |
    | 1 | 1 | XXXXX |
    | 5 | 2 | XXXXX |

    collections
    | _id | serviceID | type | url | readOnly | displayName | description | color | timezone | supportsVEVENT | supportsVTODO | source | sync |
    | 1 | 1 | ADDRESS_BOOK | XXXXX | 0 | Kontakte | <null> | <null> | <null> | 0 | 0 | <null> | 0 |
    | 14 | 2 | CALENDAR | XXXXX | 0 | Fußball | <null> | -8853644 | <null> | 1 | 1 | <null> | 1 |
    | 15 | 2 | CALENDAR | XXXXX | 0 | Gemeinsamer Kalender | <null> | -1605516 | <null> | 1 | 1 | <null> | 1 |
    | 16 | 2 | CALENDAR | XXXXX | 0 | Persönlich | <null> | -1608502 | <null> | 1 | 1 | <null> | 1 |
    | 17 | 2 | CALENDAR | XXXXX | 0 | Arbeit / Uni | <null> | -9122585 | <null> | 1 | 1 | <null> | 1 |

    SYSTEM INFORMATION
    Android version: 5.1.1 (23.4.A.1.232)
    Device: Sony D5803 (D5803)

    --- END DEBUG INFO ---


  • admin

    This may come from an interruption while DAVdroid was updated. Maybe there was a database lock so that a new column that we need couldn't be created. It should be fixed by reinstalling DAVdroid. Can you write again after you tried that?



  • Thank you for your reply. I already have tried to uninstall und install the app. And i get the same error again. But i can try today again. Maybe i should first delete cache and app files before i uninstall again.


  • admin

    Please uninstall, then reboot your device, then install it again! Hope it helps...



  • I followed your steps. Sync does not work. But i did not get exceptions anymore. Here is my debug.txt

    --- BEGIN DEBUG INFO ---

    SOFTWARE INFORMATION
    Package: at.bitfire.davdroid
    Version: 1.9.5-ose (192) from 02.12.2017
    Installed from: APK (directly)
    JB Workaround installed: no

    CONNECTIVITY (at the moment)
    Active connection: WiFi, CONNECTED

    CONFIGURATION
    android.permission.READ_CONTACTS permission: granted
    android.permission.WRITE_CONTACTS permission: granted
    android.permission.READ_CALENDAR permission: granted
    android.permission.WRITE_CALENDAR permission: granted
    org.dmfs.permission.READ_TASKS permission: denied
    org.dmfs.permission.WRITE_TASKS permission: denied
    System-wide synchronization: automatically
    Account: Cloud
    Address book sync. interval: 240 min
    Calendar sync. interval: 240 min
    OpenTasks sync. interval: —
    WiFi only: false
    [CardDAV] Contact group method: CATEGORIES
    [CalDAV] Time range (past days): 90
    Manage calendar colors: true

    SQLITE DUMP
    android_metadata
    | locale |
    | de_DE |

    services
    | _id | accountName | service | principal |
    | 1 | Cloud | carddav | XXXX |
    | 2 | Cloud | caldav | XXXX |

    sqlite_sequence
    | name | seq |
    | services | 2 |
    | homesets | 6 |
    | collections | 21 |

    homesets
    | _id | serviceID | url |
    | 1 | 1 | XXXX |
    | 6 | 2 | XXXX |

    collections
    | _id | serviceID | type | url | readOnly | forceReadOnly | displayName | description | color | timezone | supportsVEVENT | supportsVTODO | source | sync |
    | 1 | 1 | ADDRESS_BOOK | XXXX | 0 | 0 | Kontakte | <null> | <null> | <null> | 0 | 0 | <null> | 0 |
    | 18 | 2 | CALENDAR | XXXX | 0 | 0 | Fußball | <null> | -8853644 | <null> | 1 | 1 | <null> | 1 |
    | 19 | 2 | CALENDAR | XXXX | 0 | 0 | Gemeinsamer Kalender | <null> | -1605516 | <null> | 1 | 1 | <null> | 1 |
    | 20 | 2 | CALENDAR | XXXX | 0 | 0 | Persönlich | <null> | -1608502 | <null> | 1 | 1 | <null> | 1 |
    | 21 | 2 | CALENDAR | XXXX | 0 | 0 | Arbeit / Uni | <null> | -9122585 | <null> | 1 | 1 | <null> | 1 |

    SYSTEM INFORMATION
    Android version: 5.1.1 (23.4.A.1.232)
    Device: Sony D5803 (D5803)

    --- END DEBUG INFO ---



  • Now sync works again fine. I thougt it was a problem of disk space on my mobile. I has only 400 mb left. After i removed facebook and had over 500 mb space left, sync worked fine. I often read that users have various problems on their android devices when capacity is under 500 mb. Thank you for your help.



  • Thank you it's work now



  • I had exactly the same problem when updating from old davdroid 1.0 (?) to 1.9.7-ose on several android devices. Manually deinstalling and the a fresh install helped. So maybe the update process seems to be broken, because it does not create a forceReadOnly column?
    Reinstalling is of course an easy workaround.

    Thanks for the great work,

    Andreas


  • developer

    @acnb I have no idea why the upgrade fails in some cases. In all our tests, and in almost all installations in Play Store, the upgrade worked as expected. However, there were some cases where the upgrade resulted in an SQLiteException, resulting in an inconsistent database structure.

    In these rare cases, reinstalling DAVdroid causes the database to be created again, which fixes the problem.

    If you have a specific idea on why the database upgrade has failed for you, please let us know.


  • developer

    I have found the problem, which was in the database upgrade logic. It had only appeared when there was more than one upgrade step = when the database version has been upgraded from 2 to 4 = when DAVdroid is upgraded directly from <1.9 to ≥ 1.9.4. This also explains why most people (who updated to versions between 1.9 and 1.9.4) didn't experience the problem.

    Should be fixed with e09714af. We will release a new version soon. Please note that if you upgrade from v <1.9 to 1.9.4 ≤ v < 1.9.10 directly, the upgrade will still fail. In this case, you have to uninstall DAVdroid and install it again (or to delete all DAVdroid accounts, clear app storage and add the accounts again).

    Upgrading from any version, including <1.9, to 1.9.10 should work without problems.

    Thanks for reporting.