For me, the only solution was to go to-> File->Repair IDE, then in the notification, click on More->Rescan Project Indexes, then Reopen Project.
That's not the definitive solution but only in that way the IDE recognizes viewModels() again, until a new gradle sync.
I think this issue is not related to the dependencies, is more about a bug in the IDE.