7

I am trying to sign an APK manually using APK signer using this code

apksigner sign --ks D:\Android\SDK\keystores\release.keystore --ks-key-alias uploadcertificate --out app-release.apk app.apk

but it's giving me an error saying that

Failed to load signer "signer #1": D:\Android\SDK\keystores\release.keystore entry "uploadcertificate" does not contain a key

however, when I use keytool to list the aliases in my keystore, I am able to see the alias uploadcertificate.

keytool -v -list -keystore D:\Android\SDK\Keystores\release.keystore
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: uploadcertificate
Creation date: May 21, 2018
Entry type: trustedCertEntry

Owner: C=US, O=Android, CN=Android Debug
Issuer: C=US, O=Android, CN=Android Debug
Serial number: 1
Valid from: Mon Feb 13 23:47:57 IST 2017 until: Wed Feb 06 23:47:57 IST 2047
Certificate fingerprints:
        MD5:  **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**
        SHA1: **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**
        SHA256: **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 1024-bit RSA key
Version: 1

Any Idea Why this might be happening?

B0rn2C0de
  • 585
  • 1
  • 7
  • 22
  • 1
    Possible duplicate of [How do I use upload\_cert.der from play store in Android Studio?](https://stackoverflow.com/questions/51253699/how-do-i-use-upload-cert-der-from-play-store-in-android-studio) – Nick Fortescue Jul 24 '18 at 07:42
  • Did you ever solve this problem, since I am facing the exact same issue. The suggested duplicate does not provide a solution – marcel de vries Aug 16 '19 at 13:34
  • @marceldevris as far as I remember this was happening because my key was labeled as 'Android debug'. I never got around solving this problem, instead, I generated a new Key and contacted google to updated that as my app upload key – B0rn2C0de Aug 27 '19 at 18:57

2 Answers2

1

When generating your Keystore, do not use any illegal characters, especially in your password. I had "#" in my password. Generatin new key with just letters and numbers allowed me to sign the app.

More explanation/answer found here: Visual Studio's AndroidApkSigner does not find key in keystore

Edgaras
  • 449
  • 3
  • 14
0

Please check Keystore complete file name and make sure that you use same .keystore file which you uploaded in secure file (in Library) that you used alias,passwords.

Alok Kumar
  • 581
  • 1
  • 8
  • 13