As is mentioned above, you can uninstall an app while keeping its data with adb.
adb shell pm uninstall -k PACKAGE
Do note that it failed to keep data in my test case.
Then you can install the new app with
Be aware that
adb uninstall is invalid as there's no
uninstall subcommand for adb. You must connect to a shell on your device and run
pm from that shell.
install is a subcommand for adb but it does not take any options, so if you want to run
adb install -r you must type in
adb shell pm install -r instead.
Root method (Recommended):
If you have root, you should never miss Xposed Framework. Get Xposed Framework and get XInstaller. Navigate to "Installer Settings", scroll down and tick "Disable Signature Check". Now you can install the replacement app in any way you like.