android - studio - how to get keystore from apk
“Debug certificate expired” error in Eclipse Android plugins (12)
I am using Eclipse Android plugins to build a project, but I am getting this error in the console window:
[2010-02-03 10:31:14 - androidVNC]Error generating final archive: Debug certificate expired on 1/30/10 2:35 PM!
How do I fix it?
First close the eclipse then
Open CMD by Window Key + R or via Run as Admin
Follows the following step
del "%USERPROFILE%\.android\debug.keystore" keytool -genkey -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 30000
after this restart eclipse.
After you install the
Android SDK in Eclipse, it generates a debug signing certificate for you in a keystore called debug.keystore. The Eclipse plug-in uses this certificate to sign each application build that is generated.
Now, the problem with this debug certificate is that it is only valid for a year, or 365 days.
If your Eclipse IDE uses an expired debug certificate, you will not be able to create and/or deploy an Android app.
To fix this problem all you need to do is delete the debug.keystore file.
Go to Preferences
Default debug keystore
There you should see the folder where the file is located. Simply delete that file and you are good to go.
For more info. you can visit
For windows xp go to
C:\Documents and Settings\%userprofile%\.android and delete debug.keystore file, restart the eclipse and now your project get build without error.
C:\Documents and Settings\raja.ap\.android\
H-m-m-m. Interesting how so many people have had slightly different experiences with this. I remember the days when this was considered a sign that the software was not ready for release, and the team would actually fix it BEFORE users started seeing these problems:(
My own experience was just a little different. I had already tried Project>Clean, but still got the same build failure. Then I deleted the debug.keystore (under .android) just as the first answer said. Still got the same problem. Then I did a clean again, and wonder of wonders, it worked!
Now don't get me wrong, I am glad that I got it working thanks to the hints in this thread. But clearly clean isn't working right, and how did it find an expired key after I deleted the keystore??? Clearly something is wrong with Eclipse or the ADT -- not so sure which.
If a certificate expires in the middle of project debugging, you must do a manual uninstall:
adb uninstall <package_name> in a shell.
In Windows 7 it is at the path
- goto this path and remove
- clean and build your project.
It's a pain to have to delete all your development .apk files, because the new certificate doesn't match so you can't upgrade them in all your AVDs. You have to get another development MAP-API key as well. There's another solution.
You can create your own debug certificate in
debug.keystore with whatever expiration you want. Do this in the
.android folder under your
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 14000
keytool.exe can be found in the JDK bin folder (e.g.
C:\Program Files\Java\jdk1.6.0_31\bin\ on Windows).
ADT sets the first and last name on the certificate as "Android Debug", the organizational unit as "Android" and the two-letter country code as "US". You can leave the organization, city, and state values as "Unknown". This example uses a validity of 14000 days. You can use whatever value you like.
On Ubuntu, this worked:
I went to
home/username/.android and I renamed
keystoreold.debug. I then closed Eclipse, started Eclipse, and SDK created new certificate
keystore.debug in that folder.
You then have to uninstall/reinstall apps you installed via USB Debugging or an unsigned APK ("unsigned" APK = signed with debug certificate).
On a Mac, open the console (current user's directory should open), cd ".android" ("ls" to validate debug.keystore is there). Finally "rm debug.keystore" to remove the file.
The Android SDK generates a "debug" signing certificate for you in a keystore called
debug.keystore.The Eclipse plug-in uses this certificate to sign each application build that is generated.
Unfortunately a debug certificate is only valid for 365 days. To generate a new one, you must delete the existing
debug.keystore file. Its location is platform dependent - you can find it in Preferences -> Android -> Build -> *Default debug keystore.
If you are using Windows, follow the steps below.
DOS: del c:\user\dad.android\debug.keystore
Eclipse: In Project, Clean the project. Close Eclipse. Re-open Eclipse.
Eclipse: Start the Emulator. Remove the Application from the emulator.
If you are using Linux or Mac, follow the steps below.
debug.keystore from the
You can find the
.android folder like this:
Note: the default
.android file will be hidden.
So click on the places menu. Under select home folder. Under click on view, under click show hidden files and then the
.android folder will be visible.
debug.keystore from the
Then clean your project. Now Android will generate a new
.android folder file.
Upon installation, the Android SDK generates a
debug signing certificate for you in a keystore called
debug.keystore. The Eclipse plug-in uses this certificate to sign each application build that is generated.
Unfortunately a debug certificate is only valid for 365 days. To generate a new one you must delete the existing
debug.keystore file. Its location is platform dependent - you can find it in Preferences - Android - Build - Default debug keystore.
C:\Documents and Settings\\[user]\.android, Clean and build your project.
- Windows 7
C:\Users\[username]\.androidand delete debug.keystore file.
Clean and build your project.
Delete your keystore located in
~/.android/debug.keystore Clean and build your project.
In all the options if you can´t get the new debug.keystore just restart eclipse.