I had this problem for a while try launching unity hub with administrator if that doesnt work, goto Project Settings > Player > Android > Minimum api level. Mine was set above my phones and so it failed. For a while unistalling and reinstalling the editor would correct the gradle files and fix the error too.