Good morning
I'm trying to build an Android application on release mode using Visual Studio Tools for Apache Cordova CTP3.1
After I create my myreleasekey.keystore using android tools
http://developer.android.com/tools/publishing/app-signing.html
I set data in ant.properties
key.store=C:\\Users\\myreleasekey.keystore
key.alias=MoayadMyro
key.store.password=password
key.alias.password=password
I got error :
Error : BLD00213 : Signing key MoayadMyro not found. Verify the alias in ant.properties is correct.
cmd: Command failed with exit code 8
Thanks
I had exactly the same problem and no matter the permutations of keystore alias I tried, I kept getting the same error in visual studio for Apache Cordova.
To resolve I simply repeated the generation process.
Generate a new key store using keytool:
C:\myChosenDir> keytool -genkey -keyalg RSA -alias selfsigned -keystore mykeystorename.keystore -storepass mykeystorepass -validity 10000 -keysize 2048
Enter the information requested as part of the keygen:
When requested to enter the password for <selfsigned> reenter the password above. Hitting return suggests it uses the same but this is what I did before and it didn't work. [This was the only thing I did different]
Add the keystore to the project:
I placed the keystore in the same folder as the ant.properties file
Update the ant properties file:
key.store=mykeystorename.keystore
key.alias=selfsigned
key.store.password=mykeystorepass
key.alias.password=mykeystorepass
[NB: preserve the line breaks can't get them to play correctly in markdown]
I know this a bit of a turn it off and turn it on again answer but it worked for me. Best of luck.
Related
I get the title and the text below when I try and fail to build an .aab file using flutter build appbundle:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: jarsignerfailed with exit code 1 :
jarsigner: Certificate chain not found for: keystore. keystore must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
I had to reset my signing key. The google developer support had me generate a new .jks file with the following command line which I ran from within my project folder:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
He then instructed me to convert this file into a .pem file using this command:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
I then emailed him the upload_certificate.pem file. I immediately noticed that the keystore.jks file was red in the sidebar and I get this upon clicking on it:
"The file 'keystore.jks' is not associated with any file type. Please define the association:"
The .pem file is also red, but clicking on it shows the text that makes up the key.
Do I need to reset the signing key again and do something different? Is there a way to fix the issue causing this error?
As dumb as this may sound, I spent 24 hours on this and all I had to was enter flutter clean
You have keyAlias=keystore in your key.properties while it looks like the alias you created is named upload (see in your keytool export command).
Repleace with keyAlias=upload and that should work if your password is correct.
Our android project consists of mobile and wear app ( wear app is under development) and we are trying to release the mobile app. When we try to generate signed apk we get this follow message :
Error:Execution failed for task ':wear:packageRelease'.
> com.android.ide.common.signing.KeytoolException: Failed to read key
toyanathpatro from store "/home/adventure/toyanath_patro_key/toyanath_patro_key":
No key with alias 'toyanathpatro' found in keystore /home/adventure/toyanath_patro_key/toyanath_patro_key
As it reads it says failed task for :wear:packageRelease where in reality we are selecting just the mobile while choosing for signing the apk.
Can anyone point out my blunder ? Thanks in advance.
The problem seems to be with the wrongly spelled key alias
In my case the alias should have been toyanath patro where I wrongly tried to use toyanathpatro . So the best suggestion would be:
Don't use space or invisible character in the key alias. as far as possible
There is a small selection button (3 horizontal dots) on the right side of key alias editable field. Use that button to find the alias which resides in that signature file.
In your build.gradle you have defined a signing config that it's pointing to a keystore that it's not in your code base.
Something similar to this.
android {
...
buildTypes {
release {
signingConfig signingConfigs.staging
...
}
}
signingConfigs {
defaultSignature {
keyAlias 'default'
keyPassword 'password'
storeFile file('default-keystore.jks')
storePassword 'password'
}
}
}
In my case android studio by default create alias 'key0' and it is the only alias in the file.
My fast solution: Create new key file from android studio with alias that You want. Use that new created file with "Generated Signed APK". If all goes well You could run app with properties set up in "Project Structure".
After generating keystore with-
keytool -genkeypair -v -keystore my-key.keystore -alias my-alias -keyalg RSA -
keysize 2048 -validity 10000
You should use exact name of alias in gradle.properties :-
MYAPP_UPLOAD_STORE_FILE=my-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-alias <------this name
MYAPP_UPLOAD_STORE_PASSWORD=***
MYAPP_UPLOAD_KEY_PASSWORD=***
I had a sticky configuration which I could not get rid of. Even though I had changed the alias in the signing configuration window, it kept giving me the error "Could not find alias" with the original (wrong) alias that I first entered. I searched manually and found a file on path...
[project]/android/app/build/intermediates/signing_config/release/out/signing-config.json
...which contained the original (wrong) alias I first entered. Deleted the file and built/signed the app again. Hope it helps someone.
Build -> Rebuild project
It seems old key names are cached.
If you had the .Jks file before then you can get alias name by typing this command
keytool -v -list -keystore .jks
or
keytool -v -list -keystore .keystore
then you will have to type the password and you will get the alias name by that alias name you can create your signed release file easily.
My problem was that I lost my keys and when I contacted google for making a new key I made a new one with an alias name that I don't know so to solve this in your root android project cd app and paste this command keytool -v -list -keystore yourkeystore.jks don't forget to replace the yourkeystore.jks with your key you will get output we need only the Alias name copy this alias name and past it in your key.properties file like this
storePassword=YourPassword
keyPassword=YourPassword
keyAlias=AliasNameCopiedFromLastStep
storeFile=KeyStorePath
Click Build>Edit library and dependencies .
Then click plus button in signing tab. Key Alias is as same as Alias Key while generating signed apk build.
I initially used key0 for building. It failed with 'Errors while building APK'. Next time, I changed it to 'key1' to work and it worked.
Do not use capital keys for password. It's worked for me.
For generating .jks keys ,
keytool -genkey -alias myKeyStore -keyalg RSA -keystore "C:\apk\fastmoneyv1.jks"
If you are use this code when creating key
" keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload"
You have to update "keyAlias" property from key.properties
from: keyAlias=key
to: keyAlias=upload
in my case i had my keystore files already generated. I was updating my app and when i generated signed apk, i was creating new key_alias. Instead i choosed existing key alias from my keystore files and it's been resolved :)
in my case i have space on the right of the alias and you don't see that space make sure to hover is with the mouse
My issue was that I was using the "my-key-alias" instead of "key0" as the alias name so I had to check to confirm the actual key alias name keytool -v -list -keystore yourkeystore.jks and changing MYAPP_UPLOAD_KEY_ALIAS=key0 in the app/gradle.properties file instead of MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
I am trying to generate apk for releasing on Google play. I am following these steps https://facebook.github.io/react-native/docs/signed-apk-android.html
Step 1) I ran this command
$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
It asked me question which I answered and got the my-release-key.keystore file generated
I placed the my-release-key.keystore file under the android/app directory in your project folder.
Now it says:
Edit the file ~/.gradle/gradle.properties and add the following (replace ***** with the correct keystore password, alias and key password),
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****
Now there was no file previously in /root/.gradle/gradle.properties so i created a new file and added the above 4 constant and there values.
Also it tells (replace ***** with the correct keystore password, alias and key password )
This step is most confusing for me, as there is no ***** in alias field. And when I generated my-release-key.keystore file I din't get any alias
So what I should put in place of my-key-alias ?
What is basically my-key-alias?
other than the 2 passwords i entered, the keytool command generated something like this
CO=Dev Abhi, OP=The Awesome Coder, L=The Awesome Coder, M=Delhi, SP=Delhi, M=IN
are the above the alisa?
so do i need to replace things like
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=CO=Dev Abhi, OP=The Awesome Coder, L=The Awesome Coder, M=Delhi, SP=Delhi, M=IN
MYAPP_RELEASE_STORE_PASSWORD=password1
MYAPP_RELEASE_KEY_PASSWORD=password2
and also Is the real path for ~/.gradle/gradle.properties /root/.gradle/gradle.properties ??
Finally I was able to generate signed apk. So, the thing I was missing -
when you fire the command
$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
after option -alias we mention any name/term 'my-key-alias'. that's actually what we need to remember and will have to use same term like this in later step
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
rest of the things are as per documentation. But, I still feel that generating signed apk part could have been made more easy to understand bay react native team. If any one face this same issue please get in touch via http://customphpscript.com
Not sure if this will help you, but I was having the exact same issue. My problem ended up being that the file I was editing ~/.gradle/gradle.properties isn't the file in your project directory but the one in the root directory of your operating system. Once I moved the variables to that location, I was able to generate a signed apk!
Error Android packages must be signed when debugging using the Release configuration. To configure Android signing, follow instructions at http://go.microsoft.com/fwlink/?LinkID=613579 BlankCordovaApp4
key.store=E:\key.keystore
key.alias=asdfgh
key.store.password=asdfgh
key.alias.password=asdfgh
This are the following values i have given in the ant.properties files.
keytool -genkey -v -keystore E:\key.keystore -alias asdfgh -keyalg RSA -keysize 2048 -validity 1000
I tried to add another slash for key.store like this
key.store=E:\\key.keystore
During the build, I got the following information
'keystore' and 'alias' need to be specified to generate a signed archive.
I entered the details, in the res -> native -> android -> ant.properties
I tried to install that apk in my mobile and i got error saying "Install failed"
Error code -102
I need to add those keystore and passwords in build.json
first u goto inside bin in java where installed in your system .copy the path
it may be like this C:\Program Files\Java\jdk1.8.0_101\bin then run command to create key in command prompt.after entering some details u get key. http://www.tutorialspoint.com/phonegap/phonegap_app_contents.htm
then fill the datails entered when creating key in build.json like below.the the problem related to key will be solved
"android": {
"release": {
"keystore": "my-release-key.keystore",
"storePassword": "nidhin",
"alias": "nidhin",
"password": "nidhin",
"keystoreType": ""
}
}
I'm developing android app under intellij and gradle. and using following way to generate keystore file:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
then used the keystore file in build.gradle:
signingConfigs {
robert {
storePassword 'robert'
storeFile file('/Users/bournewang/Documents/Project/android.keystore')
keyPassword 'robert'
keyAlias 'mike'
}
}
when finally trying to generate signed apk file: ./gradlew assembleRelease
it gives the error:
Execution failed for task ':Myexample:packageRelease'.
Failed to read key from keystore
In order to find out what's wrong you can use gradle's signingReport command.
On mac:
./gradlew signingReport
On Windows:
gradlew signingReport
Check your keystore file for first, in you example you creating file with name my-release-key.keystore. If its correct and really present in folder Users/bournewang/Documents/Project check alias, in your example it is -alias alias_name, but in config you specified alias mike
Most likely that your key alias does not exist for your keystore file.
This answer should fix your signing issue ;)
Removing double-quotes solve my problem, now its:
DEBUG_STORE_PASSWORD=androiddebug
DEBUG_KEY_ALIAS=androiddebug
DEBUG_KEY_PASSWORD=androiddebug
In my case, while copying the text from other source it somehow included the space at the end of clipboard entry. That way the key password had a space at the end.
For me this worked.
Go to <your_app_name>/android.
On the terminal use ./gradlew signingReport for Mac OS and gradlew signingReport for Windows.
Check if each element of each task has a Variant, Config, Store, Alias, MD5, SHA1, SHA-256, Valid until. If so you should be good.
If any of the above are absent then try to regenerate the key store by following the instructions on this page.
Copy the key store file and paste it inside <your_app_name>/android/app.
Some things that I was doing wrong while generating the key store file were.
Using quotations on MYAPP_UPLOAD_..._PASSWORD's.
MYAPP_UPLOAD_STORE_PASSWORD="Password123"
MYAPP_UPLOAD_KEY_PASSWORD="Password123"
I used \J4ct#RD as a password and it did not work. I later changed the password to something that was just aplphanumeric and it worked.
In Android Studio go to Build > Clean Project then re-generate signed APK using Build > Generate Signed Bundle / APK... and then clear password-fields and re-enter your passwords
For someone not using the signing configs and trying to test out the Cordova Release command by typing all the parameters at command line, you may need to enclose your passwords with single quotes if you have special characters in your password
cordova run android --release -- --keystore=../my-release-key.keystore --storePassword='password' --alias=alias_name --password='password'
The big thing is either the alias or the other password is wrong. Kindly check your passwords and your issue is solved. Incase you have forgotten password, you can recover it from the androidStuido3.0/System/Log ... Search for the keyword password and their you are saved
Make sure you have correct the folliwn
keystore file path
keystore alies name
keystore password
keystore in android/key.properties
in my case for some reason, after updating android studio to the last stable version, the password that was always by default got changed, i just had to set correct password again and it worked
Depending on where you generated the keyfile, keytool might refer to a different binary, running on a different JVM version. These are not necessarily compatible, try adjusting the versions.
I got same error today.
Execution failed for task ':app:packageRelease'.
A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
com.android.ide.common.signing.KeytoolException: Failed to read key news from store "E:\keystore\news.jks": Keystore was tampered with, or password was incorrect
I had same key password and key store password. But i wrote a wrong password.
It could be any one of the parameter, not just the file name or alias - for me it was the Key Password.