Feb 7, 2012

Solve the “Debug certificate expired on” error message , Android Error: Error generating final archive: Debug certificate expired on

long ago i tried to run my running suddenly it showed error , but i didn't find any error in my source code in java & XML also ,

The problem comes from the fact that Android required the applications to be signed even in the debug mode. So it uses a keystore file called debug.keystore to providde keys for signing applications in debug mode. This key store file has a validity period by default 365 days from its creation date.

The First Solution:

Navigate to the .android folder in your home directory “~/.android” (Linux,Mac OS)
or c:\Documents and Settings\[User Name]\.android in windows XP
or C:\Users\.android in windows Vista or Windows 7, and delete debug.keystore file.

how to find .android folder in Linux ( UBuntu ) :

click on places menu under select home folder under then click on View Menu under click on showhiddenfiles (ctrl+h) , then u can find out .Android file

Then go to eclipse clean the project, this will create a new debug.keystore file with
default validity period 365 days.

The Second Solution:

Create a new default.keystore file with custom validity period (say 1000 days).
Navigate to the .android folder.
Delete the old default.keystore file.
We will use JDK Keytool.exe to generate the new key file. It is found in C:\Program Files\Java\jre6\bin in windows or inside the Java\jre6\bin folder in Mac OS or Linux.
Open the terminal app in Mac OS or Linux or the command prompt and navigate to keytool.exe directory.
Run the following command:
keytool -genkey -keypass android -keystore debug.keystore -alias androiddebugkey -storepass android -validity 1000 -dname “CN=Android Debug,O=Android,C=US”
This will generate a new default.keystore file with validity period 1000 days.
Copy the generated file to the .android folder, go to eclipse and clean projects and it should work.
The above command has the following options:
genkey: generates a key pair.
keystore : the name of the key store file.
alias : an alias for the key store. If the alias name is more than 8 characters the first 8 only are used.
storepass : the password for the key.
validity : the validity period for the key in days.
dname : A Distinguished Name that describes who created the key. The value is used as the issuer and subject fields in the self-signed certificate.

No comments:

Post a Comment