Sunday, February 12, 2012

Error in eclipse: error generating final archive....

When I tried to run my Android program this morning I saw an error in eclipse:
Error generating final archive: Debug certificate expired on 2/10/12 10:42 PM!

All android applications need to be signed and the default period is 365 days. This error was caused because of an expired certificate...which means I set up my Android project around this time last year!! :)

Solution:
Navigate to .android folder and delete file: debug.keystore
Go back into your project, clean and rebuild - this will regenerate the file with a new key valid for another 365 days.
You could also generate a key file with custom validity - see this blog post for more info.

After i regenerated the key file, I had errors bringing up the application on my AVD. The error was:
[2012-02-12 14:03:45 - Mayuri] Re-installation failed due to different application signatures.
[2012-02-12 14:03:45 - Mayuri] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2012-02-12 14:03:45 - Mayuri] Please execute 'adb uninstall com.mayuri' in a shell.
[2012-02-12 14:03:45 - Mayuri] Launch canceled!

Apparently the application has to be uninstalled and re-installed after regenerating the key. I tried opening an adb shell to uninstall the application and that did not work. So I ended up deleting and re-creating the AVD. 
The kinds of things you have to do to get your application to run!!

No comments:

Post a Comment