How do you fix this error that keeps happening?

I mean, it tells you - replace the deprecated method with the “proper” one. Admittedly, it may work currently, but deprecated methods are marked that way for a reason, they may stop working after any update.