Getting signature error while installing a different version of the app Recently I install a custom ROM named eelo https://e.foundation/. It comes with pre-installed Telegram app. After much research I was able to uninstall if from the system with the command adb shell pm uninstall --user 0 org.telegram.messenger. But when I tried to install the new apk with adb install telegram.apk I got the following error 

adb: failed to install telegram.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package org.telegram.messenger signatures do not match the previously installed version; ignoring!]


I also tried uninstalling with this adb uninstall org.telegram.messenger but it gave out Failure [DELETE_FAILED_INTERNAL_ERROR].
With further research I found out that I can install the new .apk with different if I comment the section in /data/system/packages.xml referring to telegram. But after making the change when I reboot it get back to the unedited version.

Currently using Android Nougat 7.1.

Can anyone tell me the reason as to why this happens and how I can stop it from happening? And how would I be able to install a different version of the app?
Ultimately found an answer to the query and how to solve it.


The first is how to delete a system application completely?
These are the following steps

$ adb root  - To start adbd with root privileges.

$ adb shell - To interact with the phone system directly.

$ pm uninstall --user 0 &lt;package&gt;.apk - To uninstall the package from the root    user  is any package you want to remove from the system.

These few steps may remove the whole package but in my case it was different as it  left behind few files from the previous built app. So these were the steps that I followed :

$ adb shell mount -o rw,remount /system - This would remount the system as read-write. Originally /system is a read-only folder so you can't edit directly.

$ adb shell rm -r /system/&lt;package&gt;.apk - This would remove the apk and there won't be anything left from the previous built.
Why I couldn't edit the /data/system/packages.xml file?

The answer to this is that though I can edit it with vim but it kept reverting back to the previous unedited form. This was happening because it was updating the information from /system/app files. Thus, editing it went in vain.


Refer to the following links that actually helped me out

https://stackoverflow.com/questions/6066030/read-only-file-system-on-android

https://www.besttechie.com/remove-preloaded-software-from-android/