Did you know that you can uninstall an application and still keep it's stored data?
Using 'adb uninstall -k app.to.uninstall' uninstalls the app but keeps the data stored in '/data/data/app.to.uninstall' on the device.
This is apparently also the default mechanism that is being used when IDEA / Android Studio uninstalls an app that has a different signature than the one you want to deploy.
Since the owner of the directory and files that can be found in '/data/data/app.to.uninstall' belong to the UID which is bound to the signature you should really not use this option on a device without superuser access
But why? It's simple: Android tries to re-install the app and create the corresponding directory underneath '/data/data'. This will fail because it already exists and belongs to a different UID.
If you can't remove the directory as a privileged user, well... you have a set of options that all contain loss of data and time.
So use the '-k' option of 'adb uninstall' with care. And don't let your IDE uninstall -k apps for you.
Here's the bug-report for this issue: https://code.google.com/p/android/issues/detail?id=65634 #AndroidDev