USB debugging switches off automatically I'm using a Huawei P20 Pro.

I'm trying to use adb according to this guide: https://developer.android.com/studio/command-line/adb.

I have enabled developer options. I can enable USB debugging, but if I go back one screen and return, USB debugging is off again.

And ideas on how I can enable USB debugging?
What worked for me is choosing "File Transfer" on android when you plug the USB instead of "Charge only"