[android] How to retrieve Key Alias and Key Password for signed APK in android studio(migrated from Eclipse)

I have an android app currently published in Google Play which I update periodically. I follow the following process to sign the app before a new push:

Press right-mouse on the project, the 'Android tools' -> export signed application package Provide keystore password Sign your app Upload the apk file into Google Play Developer Console

Recently I have imported the project from Eclipse to Android Studio and continued working on Android Studio. Now I am planning to push a fix in the app. I have figured that I have this option to sign apk in android studio

Build -> Generate Signed apk ->enter image description here

As per my understanding, for my android app I have to use the same key store and key store password which I used earlier to push updates into Google Play. Also here it's asking for Key Alias and Key Password. I don't remember the Key Alias and Key password(number 4 input in the image) while signing apk in Eclipse. Any suggestion what can I do now? If I already know my keystore and keystore password, is there an way to retrieve the key alias and alias key password?

Update: Now I can retrieve my key alias through keytool -list -v -keystore name.keystore command

This question is related to android android-studio apk signing

The answer is


If you happen to be on MacOS and checked the "save password" box in Android Studio, you can recover the password from Keychain Access.

  1. Launch Keychain Access from Applications/Utilities.
  2. Select password in Category, on the left panel.
  3. On the search box top right, type your Android app name or part of the app name.
  4. You will see the result line, if you had saved the password.
  5. Double click on it, check the show password checkbox, give your system password when asked, and it will show your keystore password.

To just restore the KEY ALIAS. Type the below command on terminal.

$ keytool -list -v -keystore <storekey>

It will give information starting,

Your keystore contains 2 entries...

You can look for the alias name there.


Based on gkemp answer, On Windows, I found the keystore file path, password, key alias and key password in an earlier log report before I updated Android Studio.

From windows file explorer c:/Users/your pc name/.AndroidStudio1.4 (your android studio version)\system\log\idea.log.1 (or any old log number)

Then I searched for “android.injected.signing.store” and found this from an earlier date:

-Pandroid.injected.signing.store.file= path to your keystore 
-Pandroid.injected.signing.store.password=yourstorepassword
-Pandroid.injected.signing.key.alias=yourkeyalias
-Pandroid.injected.signing.key.password=yourkeypassword

Yes, you can find your lost key in the task artifacts from Android Studio.

Project\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin

for updated verssion of android studio the path is:

Project\.gradle\5.1.1\executionHistory\executionHistory.bin

Open the file and search with the part of the password that you remember.

Sample(this will be in that bin file): signingConfig.keyAlias?"key name"?signingConfig.keyPassword?"key password"?signingConfig.storePassword?"Store Password"?

You can search with this string “signingConfig.storePassword” or any string given in the sample string

Note: I have experienced the same thing and I am able to find it in the above path. In case if you didn't find may be you cleared all the cache and temp files.


You might like to try this password breaker.

http://maxcamillo.github.io/android-keystore-password-recover/index.html

I was using the Dictionary Attack method. It worked for me because there were only a few combinations to my password that I could think of.


Just Open yourApp.jks file with Notepad you will find Keystore & Alias name there!!


Unfortunately solutions provided above, aren't beginner friendly.

It's

keytool -list -v -keystore keystore_name.jks

You can find your keystore details without using password as following way.

Execute the command (keytool -list -keystore <path>) in command prompt

You can find the Keytool in java folder in my machine I could find form the following path

C:\Program Files (x86)\Java\jdk1.7.0_71\bin> keytool -list -keystore C:\<YourKeystore>.Keystore

Then it will ask you to enter the password, Here you don't need to enter the password instead of that press up arrow button and enter it. then the same details will be display with warning message as below.

***************** WARNING WARNING WARNING *****************

  • The integrity of the information stored in your keystore *

  • has NOT been verified! In order to verify its integrity, *

  • you must provide your keystore password. *

***************** WARNING WARNING WARNING *****************

Keystore type: JKS Keystore provider: SUN

Your keystore contains 1 entry

samplekey, Apr 26, 2017, PrivateKeyEntry, Certificate fingerprint (SHA1): XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX


how to retrieve keystore password

You cannot retrieve the password. If you forgot it, you are doomed.

how to retrieve key alias

$ keytool -list -v -keystore <store>

But you need keystore password for this first.

EDIT

What I don't remember is the 'Key Password'

No password can be restored. If you forgot key password for good then you are doomed too and there's no other way than trying harder to recall it. There's no password reset thing nor anything like that.

Be aware that if you forgot your password for good then you will issue no further updates to your app (docs):

Warning: Keep your keystore and private key in a safe and secure place, and ensure that you have secure backups of them. If you publish an app to Google Play and then lose the key with which you signed your app, you will not be able to publish any updates to your app, since you must always sign all versions of your app with the same key.


I tried a lot of solves and only that work with me and i will share it with you

enter image description here

enter image description here

enter image description here

search by Ctrl + F


If looking in the logs doesn't help, you can also try to brute-force the password - check method 3 on this post - Android KeyStore Password Recover.

This SO post has more answers as well.


In ubuntu, we can find all password related to keystore from the given path.

/home/user/.AndroidStudio2.2(current version)/system/log/idea.log.x(older versions)

edit the file and search android.injected.signing.store , then you can find the passwords.

-Pandroid.injected.signing.store.file= path to your keystore 
-Pandroid.injected.signing.store.password=yourstorepassword
-Pandroid.injected.signing.key.alias=yourkeyalias
-Pandroid.injected.signing.key.password=yourkeypassword

On the Mac, I found the keystore file path, password, key alias and key password in an earlier log report before I updated Android Studio.

I launched the Console utility and scrolled down to ~/Library/Logs -> AndroidStudioBeta ->idea.log.1 (or any old log number)

Then I searched for “android.injected.signing.store” and found this from an earlier date:

-Pandroid.injected.signing.store.file=/Users/myuserid/AndroidStudioProjects/keystore/keystore.jks, 
-Pandroid.injected.signing.store.password=mystorepassword, 
-Pandroid.injected.signing.key.alias=myandroidkey, 
-Pandroid.injected.signing.key.password=mykeypassword,

On Windows

you can find your lost key password in below path

Project\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin or ..taskHistory\taskHistory.bin

Here is the image for path view in folder structure

open the file using appropriate tools e.g. NotePad++ and search with the part of the password that you remember. You will find it definitely. Else, try searching with this string "signingConfig.storePassword".

Note: I have experienced the same and i am able to find it. In case if you didn't find may be you cleared all the cache and temp files.


Click the KeyAlias you will get to know the alias name

enter image description here


Recover your keystore password

100% working

Projects->taskHistory.bin

enter image description here

Find->KeyAlias

enter image description here

Note: Click and View my images for your reference

Now for updated android studio task history has been changed to execution history[!


Just open the key file (.jks file) with notepad++ .You will get the alias name in the first line...


Android Studio 3.0 below working method:
Find your old zipped project.
If you have built the apk, you'll find the password in file:

Project\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin

Pandroid.injected.signing.store.password=password

If you don't have zipped project, search your git repositories if you have .gradle folder pushed or not.
Otherwise you'll have to recover files and search files by content "Pandroid.injected.signing.store.password".


In windows - Just open your keystore file in notepad, and on very first line - you can see your alias written in English letter.


I have found my key password in below path

Project\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin open the file and search with the part of the password that you remember. You will found it definitely.

Also, You can refer this answer stackoverflow.com/a/43007357/7089151


In any case you are confused with your password.You can use hit and trial. It will ask you for password.If it right then it will show you the list.

  • List item

$ keytool -list -v -keystore filename


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to apk

Application Installation Failed in Android Studio Difference between signature versions - V1 (Jar Signature) and V2 (Full APK Signature) while generating a signed APK in Android Studio? Session 'app': Error Installing APK Android Error Building Signed APK: keystore.jks not found for signing config 'externalOverride' Build and Install unsigned apk on device without the development server? The APK file does not exist on disk Android Studio: Application Installation Failed How to retrieve Key Alias and Key Password for signed APK in android studio(migrated from Eclipse) ADB Install Fails With INSTALL_FAILED_TEST_ONLY Upload failed You need to use a different version code for your APK because you already have one with version code 2

Examples related to signing

Difference between signature versions - V1 (Jar Signature) and V2 (Full APK Signature) while generating a signed APK in Android Studio? How to retrieve Key Alias and Key Password for signed APK in android studio(migrated from Eclipse) How can I add private key to the distribution certificate? How to sign an android apk file What is the difference between encrypting and signing in asymmetric encryption?