Certificate chain not found, how to fix and publish to Google Play Store?

AndroidKeytoolJarsignerJar Signing

Android Problem Overview


ERROR MESSAGE:

jarsigner: Certificate chain not found for: project_foo.<br/>
project_foo must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

QUESTION: How do I include a public key certificate chain to address the error?

BACKGROUND: The App Developer has completed an Android app and delivered an unsigned APK called Foo.apk. My objective is to sign and zipalign the APK in preparation for uploading it to the Google Play store. My keystore is located at C:\Path\.keystore on a Windows machine.

COMMAND LINE, my command:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore C:\Path\\.keystore Foo.apk project_foo

COMMAND LINE, response:

Enter Passphrase for keystore:
jarsigner: Certificate chain not found for: project_foo.<br/>
project_foo must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

ALSO TRIED: Verified that I remember the correct password. Using 'keytool -list' from the command line shows me the expected list (it includes one private key).

PREVIOUS OS QUESTION: https://stackoverflow.com/questions/5259263/certificate-chain-not-found asked using a .cer file from Verisign. I have no similar file available.

OTHER INFORMATION: Windows 7 machine, using standard Windows command prompt.

Android Solutions


Solution 1 - Android

keytool -keystore formconnect.keystore -list -v

You can use this command to find out your alias name after you have generated your key.

First line of execution contains the Alias name: <value> If keytool is used then alias name might be "mykey".

Use that alias name while packaging the application.

Solution 2 - Android

i had the same issue my commands were

to generate key

 keytool -genkey -v -keystore testapp-key.keystore -alias testapp-key -keyalg RSA -keysize 2048 -validity 10000

and then i did this to sign the app

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore testapp-key.keystore testapp.apk testapp

i got this error

jarsigner: Certificate chain not found for: testapp.<br/>
project_foo must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

then i replaced the alias 'testapp' in the jarsignir command with the key alias that is 'testapp-key' it is in first command i.e. key generation command

the command will look like this

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore testapp-key.keystore testapp.apk testapp

in your case it will be like this

 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore C:\Path\\.keystore Foo.apk your-key-alias

Solution 3 - Android

The Developer on our team proposed the solution that fixed the problem. Previously I had copied the Foo.apk into the directory with the jarsigner.exe and tried to run it there. He proposed:

  1. Set the PATH environment variable so Windows can find the jarsigner executable.
  2. Move the Foo.apk to the path where the keystore was located.
  3. Run the command below (without using a path to find the keystore).

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore .keystore Foo.apk project_foo

It works! Removing the necessity to specify file path for the keystore fixed the problem.

Solution 4 - Android

add release unsigned.apk folder path

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore keystorename.keystore .....\platforms\android\build\outputs\apk\android-release-unsigned.apk aliasname

it's work for me !!

Solution 5 - Android

If you are trying to sign your .aab or .apk ,from Android Studio but keep getting this error even though you are doing everything right, here is the solution that worked for me: Go to search and find Command Prompt. Run it as Administrator. Now Type this line.

"C:--->Your Path To jarsiner<---\jdk1.8.0_192\bin\jarsigner" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "C: **--->Your Path To the Keystore<---**\Desktop\OfficalBuilds\MyKey.keystore" "C:**--->Your Path To the .apk Or .aab<---**\Desktop\MyFinalBuild.aab"  "My Alias "

If you tried the above solutions,you will notice now the alias is typed inside " ". Also sometime there is a space at the end "My Alias "

Solution 6 - Android

you have to name your signed App like alias name

for example:

if you have this name "myFirstSignedApp" as alias then you have to determine this name in jarsigner command

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore testapp.keystore app-release-unsigned.apk myFirstSignedApp

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncampbellwarrenView Question on Stackoverflow
Solution 1 - AndroidUmit KayaView Answer on Stackoverflow
Solution 2 - Androidtanveer ahmad darView Answer on Stackoverflow
Solution 3 - AndroidcampbellwarrenView Answer on Stackoverflow
Solution 4 - AndroidDhanashri DhokeView Answer on Stackoverflow
Solution 5 - AndroidThe OathmanView Answer on Stackoverflow
Solution 6 - AndroidAli MohammadView Answer on Stackoverflow