This was the 3rd time, I ran into this issue. The debug certificate expired. No where in the project, I could find an error but while trying to Run/Debug my application, the message “Your program contains error…..” was shown. Finally, I found the debug certificate was expired. In the error list I saw:
Error generating final archive:
Debug certificate expired on 1/30/13 3:39 PM!
Hmm, seems I know it. I went to my .android folder and just deleted the debug.keystore file. I know Eclipse will regenerate this file. And it worked.
But while trying to run the application,
Re-installation failed due to different application signatures.
You must perform a full uninstall of the application. WARNING: This will remove the application data!
Please execute ‘adb uninstall com.something.something’ in a shell.
I think I remember the next best thing I did the last time. Wiped user data from the Emulator. Mmm, it should work and it worked. Voila! Is it the right way?? I don’t think so, I searched for a better solution and got the following information after google-ing a bit, I think would be great to list in this blog. [If no one finds this useful, at least I can have reference for future!! I know, I know this is a very primitive issue for droid-ers :-)].
developer.android.com: The self-signed certificate used to sign your application in debug mode (the default on Eclipse/ADT and Ant builds) will have an expiration date of 365 days from its creation date.
So, I would like to use the keytool.exe to set expiry of my debug certificate as long as I want.
The parameter -validity will take values in days for the expiry of the certificate. So, this made my certificate valid for 9000 days. I don’t know if I would work on Android that long…:-)
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 9000