PasswordLoginForbidden when trying to synchronize with Davdroid

Nextcloud version (eg, 12.0.2): 14.04
Operating system and version (eg, Ubuntu 17.04): Ubuntu 16.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.18
PHP version (eg, 7.1): 7.0

The issue you are facing:

I am unable to synchronize contacts and calendars my Android client with Davdroid. It does work with other clients. I have 2-factor authentication enabled. Davdroid synchronization does not work, regardless whether I use my user password or a dedicated app password.

The Davdroid log (which is shown after timeout) contains this:

OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden

And the Apache log has tons of these:

"PROPFIND /remote.php/dav/ HTTP/1.1" 401 1050 "-" "DAVdroid/2.0.5-ose (2018/11/07; dav4android; okhttp/3.11.0) Android/8.0.0"

I.e., a 401 Unauthorized error.

Needless to say that I double-checked the app password a gazillion times.

Why does it not work and what can I do to make it work?