Database error - caldav and carddav detected but sync doesn't work
Hello everybody !
I'm new here, so thank you for this app
I installed DAVdroid a couple of days ago on my Android device, and i encountered some issues. First I have a xiaomi device, and thanks to this topic I could solve the auto-start problem.
(I looked for a similar issue on the forum but didn't find)
But I still cannot sync my calendars and contacts. Every time I click on the sync button, I obtain this notification:
Address book synchronization failed (<account name>) Database error while downloading remote entries
And when I click on the notification, it redirects to the debug info.
I use ownCloud (NextCloud in fact but it doesn't matter I think) on a zaclys server (associative and free server, respect of privay, etc).
My device is a Xiaomi Redmi 2A (in the debug info below: HM 2A) with Android 4.4.4 (KTU84Q, I don't know what it means) and MIUI 8 (version 6.10.27) and I installed the latest version of DAVDroid from F-Droid.
What I tried:
I tried a lot of different urls to see if it changes something, but I think it's not the problem (no error messages, I can properly create my account, etc). Examples:
https://webcloud.zaclys.com/remote.php/caldav/ https://webcloud.zaclys.com/remote.php/carddav/ https://webcloud.zaclys.com/remote.php/dav/
And it seems it's not a server configuration issue, because the app detects the calendars and the contacts, as you can see on this screenshot:
Here is the debug info, I hope it will help.
Thank you for your attention and your help
EXCEPTION: at.bitfire.vcard4android.ContactsStorageException: Couldn't apply batch operation at at.bitfire.vcard4android.BatchOperation.commit(BatchOperation.java:66) at at.bitfire.vcard4android.AndroidContact.create(AndroidContact.java:636) at at.bitfire.davdroid.syncadapter.ContactsSyncManager.processVCard(ContactsSyncManager.java:442) at at.bitfire.davdroid.syncadapter.ContactsSyncManager.downloadRemote(ContactsSyncManager.java:350) at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.java:170) at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.onPerformSync(ContactsSyncAdapterService.java:66) at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259) Caused by: android.content.OperationApplicationException: App op not allowed at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:158) at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:512) at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:393) at at.bitfire.vcard4android.BatchOperation.runBatch(BatchOperation.java:82) at at.bitfire.vcard4android.BatchOperation.commit(BatchOperation.java:55) ... 6 more
According to the error message, DAVdroid is not allowed to insert the contact into the address book.
Android version: 4.4.4 (KTU84P) Device: Xiaomi HM 2A (lte26007)
As far as I have heard, there is a special permission and privileges system for Xiaomi. Please check the app permissions, see also FAQ: [Xiaomi MIUI] How do I enable DAVdroid synchronization?.
Ow... I feel so stupid...
Sorry for the disturbance and thank you for your answer.
I spent so much time and looked for so many solutions and I just forgot to give the app the permission to read and modify contacts and calendars ...
For those who don't know how to manage the permissions in MIUI:
Method 1: App Settings, scroll down, Permissions, Permissions, look for DAVDroid app, finally accept the permissions Modify and delete contacts, Read your contacts and Read calendar events.
Method 2: App Security (may be in the folder Tools on the main homepage), Permissions, Permissions, look for DAVDroid app, finally accept the permissions Modify and delete contacts, Read your contacts and Read calendar events.
@TheFreeBeginner Thanks for confirming the solution.