Avast email scans make Outlook fail to connect

I have been struggling with setting up Outlook 2019 on a new Windows 10 laptop. It has not been possible to connect gmail to Outlook. I got all kinds of errors (failed to send test email, or got "can not sync folders, etc…). Spent 2 days, with no luck. Using imap and smtp
Turns out it is a problem with Avast! (using free version 21.1.2449 (build 21.1.5968.56)
If I set MailShield to scan inbound, I get errors. Outlook fails (in different ways: either can not even set up the account -test email fails, or I get the 0x800ccc0e error. If I disable scan inbound, all works. Most likely something to do with imap…,
Is there a fix for this?