Why does the app signature change in Android after a classpath change?

espinchi picture espinchi · Mar 17, 2010 · Viewed 13.2k times · Source

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?

Answer

CommonsWare picture CommonsWare · Mar 17, 2010

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.