android.database.sqlite.SQLiteException: no such column: metadata_dirty (code 1): , while compiling: SELECT […] FROM view_raw_contacts_restricted AS view_raw_contacts WHERE ((1=2)) AND ((dirty!=0)) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:179) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135) at android.content.ContentProviderProxy.query(ContentProviderNative.java:421) at android.content.ContentProviderClient.query(ContentProviderClient.java:145)
If you get an error message like this when DAVx⁵ is synchronizing contacts, it means that Android's contacts provider couldn't process DAVx⁵'s request because should be a field called metadata_dirty
in your local contacts database, but it's not there. (See How does DAVx⁵ integrate with Android? to learn about the interaction between DAVx⁵ and the contacts provider.)
Why does this happen?
Android's contact database has changed in recent versions and new fields were introduced and used internally.
However, on some devices, the upgrade routine to Android 7 which should add this field is not executed correctly for some reason. This is an Android/firmware problem and does not only affect DAVx⁵.
Solution
The error comes from the Android Contacts Provider, which resides in a system app called Contact storage (com.android.providers.contacts
). To solve the problem, it's necessary to restore database integrity by deleting the local database:
- Save all your contacts (for example on the server). Make sure you have a reliable backup!
- On your Android device: Settings / Apps / System apps / Contact storage (
com.android.providers.contacts¹
) / Storage / Delete data - Force synchronization in DAVx⁵
This procedure deletes the local contact database including all local contacts. Android automatically creates the database again as soon as it used. DAVx⁵ will download all contacts again.
¹ may have a branded name on some devices, e.g. com.motorola.blur.providers.contacts