Updating android app causes a crash unless you uninstall the old one

Hello! I’m using unity 2023.2.20, and when I build an android app, if the “old version” of the app is installed on the android phone, it causes a crash with a nullpointer thing, but if I uninstall the old app then it works fine. What is the best workaround for this? thanks in advance!