I\'m using gradle (assembleRelease) to generate the release apk.
I have saved the keystore file in project/app/filename.keystore (Within the application
My problem was that I had entered a random keyAlias. When trying to sign the apk using the IDE (IntlliJ Idea and Android Studio: Build menu -> generate signed APK), by clicking the ellipse button (...) next to the textbox for entering key alias, I found the correct key alias that I had earlier set for my keystore. Double check that you are not entering some ad-hoc random password and keyAlias for your keystore as they should be identical to the password and key alias you set for your keystore when creating it.
If you have forgotten either the password or the key alias, I am afraid you have to create a new keystore as you cannot read your keystore without these. I suggest saving these two properties (and attaching your keystore file) in a password manager like Lastpass, as you need them in future.
I was using double-quotes with alias and passwords as shown below
storePassword="spass"
keyAlias="kalias"
keyPassword="kpass"
Removing double-quotes solved my problem
storePassword=spass
keyAlias=kalias
keyPassword=kpass
I have not fully fixed this issue, but I think it is related to the following entries in 'Telegram\TMessagesProj\build.gradle':
signingConfigs {
debug {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
release {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
Note that the DEBUG config is set to us a 'release.keystore'.
The passwords and alias are stored in 'Telegram\gradle.properties' and I have had some success by changing these to the ones I use when signing APKs and changing the debug line to point to your own signing key (created through Android Studio).
E.g. Change the line to
debug { storeFile file("path/to/your/signing/key/ApkSigning.jks") ... }
And set the appropriate passwords and alias in the gradle properties file.
Hope that helps.
My problem was that I had extra whitespace in the gradle.properties file. So if you have entries like this:
MYAPP_RELEASE_KEY_ALIAS=my-key-alias(\s)(\r\n)
Make sure there is no leading whitespace for all the entries:
MYAPP_RELEASE_KEY_ALIAS=my-key-alias(\r\n)