How to Fix Android Debug Certificate Expire Error

Problem:

You are getting the following error:

android Error generating final archive: Debug certificate expired on ...

One day when you opened your Eclipse with Android tool chain installed, suddenly you see this error, which may seem weird because you know that Eclipse uses just some random certificate for debugging and so why is it expired and what to do.

The Solution:

Simply delete the keystore file which is located in

%USERHOME%/.android/debug.keystore (on Windows)

or

~/.android/debug.keystore (on Linux and OS X)

Restart your eclipse and you are all set.

Why this happens:

The reason to this is that the debug certificate is set to expire every year or 365 days.

If you do not wish to be bothered by this again in a year, you can use the keytool executable from the Android tool chain to generate a certificate with a longer expiration period.