4

I have an Android project that branched into three different applications, app-1, app-2 and app-3, that apply some customizations. Currently there is a lot of code duplication, making maintenance a nightmare: do the changes in one of the branches, and then merge the other two.

So we create a library project, named app-core, that factors out most of the duplicated code. So far so good.

When I launch this into an emulator where the application was already loaded (before the refactoring), I get this exception:

Re-installation failed due to different application signatures

A different signature? But I just added a line in the .classpath to link to the app-core Java project!

The main question is: are the existing users going to be bothered by this too?

And the side question: Why is it a different signature?

espinchi
  • 9,144
  • 6
  • 58
  • 65

4 Answers4

12

The digital signature is driven by a signing key that exists on the machine that signs the app. If Developer A compiles an app using the standard debug key and installs it in an emulator, then tries installing some other variation of the app -- one signed with a production key, one signed with Developer B's debug key, etc. -- in the same emulator, you will get that error.

The main question is: are the existing users going to be bothered by this too?

Do you have the production signing key that you used for the version of the app your existing users are using? If yes, then there should be no problem. If no, you're screwed.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Is there any way to get production signing key? Or really, I'm screwed? – Pradip Kharbuja Aug 11 '13 at 10:51
  • @PradipKharbuja: "Is there any way to get production signing key?" -- you created it before shipping your app. – CommonsWare Aug 11 '13 at 11:24
  • I mean can I retrieve that key again? Because I lost it... :( – Pradip Kharbuja Aug 11 '13 at 16:03
  • 1
    @PradipKharbuja: Restore it from the backup you made of your development machine. If you do not back up your development machine, you are pretty much out of luck. – CommonsWare Aug 11 '13 at 21:18
  • I made two "totally" separated apps, although the second app is greatly copied from the first app .. when the first app is installed I can't run the second app on my S4 ? what should I do to run both apps in the same device ? thanks – McLan May 20 '14 at 12:12
  • @Rania-Boy: They have to have separate package names. – CommonsWare May 20 '14 at 12:38
  • what is the name of the key? or what is it's file type. Is it the .jks file? because I copied it over from my pc to my mac, but am still having the same problem. Also, I'm now using AndroidStudio, so the file system is a little different, but I've named the package name the same. Well, I basically want to know if it's the .jks file. – flobacca Oct 16 '14 at 20:53
  • 1
    @flobacca: "what is the name of the key? or what is it's file type." -- the debug signing key is in the `debug.keystore` file. On OS X, it should be located in `~/.android`. The production signing key would also be a Java keystore. Whether you named that file with a `.jks` extension or not was up to you. – CommonsWare Oct 16 '14 at 21:01
  • @CommonsWare thanks found the debug.keystore file in my pc and replaced the debug.keystore in my mac. Found it where you said I would. (don't worry orig mac file not lost). But still getting same error. Different application signatures. Will keep working on it as already on google play. Can't ask people to uninstall and install this new app. – flobacca Oct 16 '14 at 23:31
  • @flobacca: You did not use a debug keystore for distributing your app on the Play Store. You used your production keystore. Where you stored that keystore, and what you named it, was up to you. – CommonsWare Oct 17 '14 at 00:20
  • true. I'm just saying that I transferred both the pc debug and production keystores to my mac with androidstudio. I referenced the prod. keystore when I made the signed apk. So I believe the prod. keystore has been replaced and referenced properly. I copied over the mac debug.keystore with my pc debug.keystore, however the reference to the debug keystore maybe incorrect. I believe it is the last thing that could be wrong, but I don't know where to find it. Error:Installation failed since the device already has an application with the same package but a different signature. – flobacca Oct 17 '14 at 00:50
  • Found this in Android Troubleshooting guide "keystore/key already generated by the Android build tools." So I haven't changed the build tools, so it probably is referencing the correct debug.keystore, which is the one from my pc. So I don't know what's wrong. Since I only have 5 users, will just have them uninstall when the next update comes along. Thanks CommonsWare. – flobacca Oct 17 '14 at 01:00
1

Uninstall the application on the device, then run code again, it will work. It happens for me and I tried same thing, now it is working correctly.

morvix
  • 11
  • 1
0

For this problem u need to check that the correct key is used under (Window->Preferences->Android->build). This u can check from the android.mk file of the app. And on placing the correct key path , CLEAN and BUILD the project to avoid this error .

beginner
  • 383
  • 3
  • 5
  • 19
0

I have had the similar kind of issue. If you are installing it on your device then you need to uninstall the app on your device prior to install it from eclipse. It will definitely solve your problem.

Cheers