0

This is my first questions on SO, but I would first like to thank the community for helping me along the way in creating a few Android apps. I am not a programmer by profession, and most of the stuff I make is just for fun, but one Android app is a real project that I created for a client, and I've run into some real trouble and need some help.

The app I made basically takes in some data, stores it into an SQL database, and when necessary, uses queries to pull various information from the DB, and displays it. If any adjustments need to be made, I make them and just send them another .apk. No problem, until now...

I recently upgraded to Windows 10, doubled my laptop's RAM and replaced my hard drive with an SSD, and did a refresh of the OS. Everything, including Android Studio, runs like a dream now!!! I had a request from my client to make a few adjustments, so I recopied my backed up source code to my projects folder, opened the code, made the modifications, and resent the .apk to my client. They are getting the following message:

"X App not installed.

An existing package by the same name with a conflicting signature is already installed."

The only changes I made to the app were adding a table to the database (and upgrading the DB version number, of course), and modified some layouts and a couple of methods and calculations, etc. Nothing more. I have searched up and down and have even replicated the same error on my tablet and can't find a way around it. My client currently has a few months worth of data input into the app, so they can't just uninstall it and do a new app installation. Is there anything I can do at this point? Also, I never made any custom key signature, just programmed, made .apk, and have sent numerous updates without issue. Any help would be greatly appreciated. (I have all my project folders and .apks backed up for all the different versions that I have sent)

Thank you!

Standroid
  • 1
  • 2
  • Did you use the same key to sign the release version of the app? Checkout http://stackoverflow.com/questions/19959890/android-app-not-install-an-existing-package-by-the-same-name-with-a-conflicting – Shobhit Puri Feb 23 '16 at 23:40
  • While a mismatched key is probably causing this problem, in the future I would really suggest adding an export or backup feature into your application if the only copy of your client's important data is currently on a single tablet in a format they can't access directly. – Matti Virkkunen Feb 23 '16 at 23:41
  • @ShobhitPuri, I did not create a key or sign the app at all. I just built the project , and the apk, and then sent that and any other upgrades to the client. – Standroid Feb 23 '16 at 23:44
  • @MattiVirkkunen, that was going to be a future feature of the app, among other things... – Standroid Feb 23 '16 at 23:45
  • @Standroid If you didn't make a key, it makes one for you. If you did anything like reinstall the IDE or used a different computer then you'd be using a different key. – Gabe Sechan Feb 23 '16 at 23:45
  • Plan of action now is to find out where Android Studio stores its autogenerated key and restore it from a backup you hopefully have. – Matti Virkkunen Feb 23 '16 at 23:46
  • I think its stored in `C:\Users\\.android\debug.keystore` but since you upgraded your OS, it might have changed, which is causing the issue. – Shobhit Puri Feb 23 '16 at 23:47
  • @GabeSechan I did reinstall Windows, and subsequently the IDE, but I have all of my old source code folders. Is there a way I can see from my old files, what key was used? – Standroid Feb 23 '16 at 23:52
  • No. If there was the key would be worthless- it would be equivalent to an attacker being able to generate the key. The key is almost certainly gone now. – Gabe Sechan Feb 23 '16 at 23:53
  • 1
    @MattiVirkkunen and Shobhit Puri, thanks, I will check it out – Standroid Feb 23 '16 at 23:53
  • 1
    @GabeSechan, thank you. So do you think there's absolutely nothing I can do at this point? – Standroid Feb 23 '16 at 23:54
  • Nothing to get that key back, unless the process saves a key-old or something of the like (check in the directory @ShobhitPuri said). You can save the data, it just requires care, work, and possibly rooting. – Gabe Sechan Feb 23 '16 at 23:55

1 Answers1

2

Your best bet at this point, assuming you can't find/get the original key, is to use a backup program (or adb pull worst case) to backup his /data/data/ folder. Then you can uninstall the original app and reinstall the new version. Then you can restore/adb push the old folder's contents to the phone to restore the data files. This may require rooting it.

If possible I would test this on another phone first, to make sure it works, since you only get 1 shot at this. I would also save your key in your source control repo in the future.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Thanks, I can test this on my tablet and another one as well I guess. Like I said, I'm no pro, and this was a HUGE oversight on my part. Do you know if there's a method similar to using the Android Device Monitor to push and pull the database from the tablet? For example, to test my data and queries, I pull the database from the Genymotion-emulated device, and open it in SQLiteman, to see the data, run queries, etc. – Standroid Feb 24 '16 at 00:04
  • You can look into setting up Stetho in the app so easily view and test queries. facebook.github.io/stetho – michaelcarrano Feb 24 '16 at 00:57