I am writing project in React Native with Expo.
Tried to Build it.
when I type command expo build:android
I choose apk type
then it asks me if you want to have us generate keystore one for you?
I chose auto generate and this happens
I have Java SDK installed even double checked keytool.exe is there. I can generate manually.
but how can I solve this?
P.S Already did in Environment variable I wrote java path in PATH variable.
Ensure jre is installed.
cd /path/to/jre/bin/folder
As keytool file is present in the bin folder of jre, give path till bin as in the command above.
Then you can do:
keytool -genkey -alias aliaskeyname -keyalg RSA -keystore C:\mykeystore
The additional option -keystore will help you to specify the path where you want the generated self signed certificate.
Related
After building my project on Android Studio 1.2 on Ubuntu 14.04 I can't get any debug.keystore on the ./android folder which I need for the google maps API. I tried it again and again but could not get it. Can somebody help me?
According to documentation..
debug keystore resides in path : $HOME/.android/debug.keystore
and if it is not there, it will generate it automatically (After you test your application in debug mode)
read this from android developer documentation.
Alternatively, you can generate a keystore without Eclipse with the following JDK command from wither a Windows command prompt or Cygwin with this command:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Keytool is a part of the JDK and needs to be in the system PATH to be used in this way. The path should be something like: C:\\bin
Once generated, be sure to copy the keystore file into the proper location. If you ran the command from your Cygwin home directory (the directory cygwin starts in), you will find the debug.keystore file here: C:\\home\\
A more practical answer can be found at Missing debug.keystore
Even though the answer on the following link was answered from a windows perspective I still believe it will help you solve your problem.
I am attempting calabash-android run file.apk.
I get the following output error msg
Could not list certificates in keystore. Probably because the password
was incorrect. (RuntimeError)
I also tried running this command
calabash-android resign file.apk
then also receiving same error.
I have also set proper path of android-home and java-home in the environment variable and have added to the path
Any assistance in solving the problem would be greatly appreciated.
Thanks in advance.
There are two scenarios where I have encountered this to happen:
I found out that if the .android folder in your home directory might not have the file debug_keystore. If it does not have this file, go to your .android directory through terminal and then type out:
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000
If you have extracted the test folder from a repository and the original uploader used a different gem version to generate the project structure, then you could see this. Solution would be to simply generate a new project structure and then include the tests in your structure.
Not that I would ever do this but let's say you have a friend. And let's say this friend tried to troubleshoot without a clear direction and ran:
$ calabash-android setup
And imagine this friend took some crazy liberties with filling out the prompts and didn't realize his failed troubleshooting left a calabash_settings file in the root of his project directory. If he were to remove this file and follow Sunil's advice, everything might turn out okay for him.
I've used phonegap Build to create my .apk file and i'm trying to sign it.
I understand that I can do this with the following command:
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000
But when I run this in terminal I get 'command not found' ?
I'm running this on a mac so from what I've read I have the required JDK installed ( I have xcode ) I guess it might be that the PATH is not set correctly to keytool, but I'm unable to find any simple info on resetting this.
Any help would be hugely appreciated. I must be missing something very simple as it can not be this difficult to sign the app ?!?!
This was a nightmare for me, such a seemingly simple task took far too long.
to locate Keytool on a mac
first type this into command prompt:
/usr/libexec/java_home -v 1.7
it will spit out something like:
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
keytool is located in the same directory as javac. ie:
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin
From bin directory you can use the keytool.
I usually use the APK tools in Eclipse to sign keys but I generated the fingerprint in past and didn't record it. I need keytool to tell me that value...
Hopefully that helps someone else
Just a note i had to add './' in front within the keytool location.
Keytool Location
/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool
Command run
./keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
Hope that helps someone.
Make sure you have cd'd into the android-sdk/platform-tools directory (where the keytool will [most likely] reside). The command won't be found if you aren't in the keytool-containing directory.
keytool comes with the Java Development Kit (JDK). So look for the directory that contains javac, java and you will find keytool present over there. You can run it directly from that directory or set the PATH.
I had this same error when running on Mac.
Removing the '$' worked for me, and was then prompted to enter the details to create the keystore.
I then had trouble finding the keystore, as I thought it would be within .android under my user account, but it was actually saved straight to my user account [cd users/YourUserName]
Hope that helps anyone with the same issue
New location for keytool if you have Android Studio installed is
/Applications/Android\ Studio.app/Contents/jre/Contents/Home/bin/
keytool -list -alias androiddebugkey -keystore "C:\Users\hp\.android\debug.keystore" -storepass android -keypass android
thats what i type into my command, on windows 7 and i keep getting the reply "keytool is not recognised as an internal or external command, operable program or batch file."
=S not sure weather to install andriod again or if ive miss typed something
The keytool utility is not part of the Android SDK, but the Java JDK.
It appears you may not have your JDK bin/ directory in your PATH. While in a command-prompt, try browsing to the directory C:\Program Files (x86)\Java\jdk#\bin (# is your jdk version installed) then running the command.
Note: If you are using jdk 1.7.0 you may need to add the -v option to keytool as it doesn't give MD5 by default, only SHA.
i am trying to sign an apk by following this guide.
I created a keytools folder in C:\Users\Family\workspace\ and a keys folder in the newly created keytools folder. So now i have C:\Users\Family\workspace\keytools and C:\Users\Family\workspace\keytools\keys folders.
I copied the debug.keystore into the keys folder and copied the keytool.exe and jli.dll into the keytools folder.
I ran cmd.exe and navigated to C:\Users\Family\workspace\keytools and ran keytool -genkey -alias anddev.keystore -keyalg RSA -validity 20000 -keystore keys/anddev.keystore
The anddev.keystore file is created in the keys folder.
I copied the apk to be signed into the keytools folder. I also copied jarsigner.exe into the keytools folder.
In cmd.exe I am at C:\Users\Family\workspace\keytools and trying to run: jarsigner -verbose -keystore C:\Users\Family\workspace\keytools\keys\anddev.keystore -signedjar sampleapp_signed.apk sampleapp.apk anddev.keystore. It gives me this error:
I also tried to run:
jarsigner -verbose -keystore C:\Users\Family\workspace\keytools\keys\anddev.keystore -signedjar sampleapp_signed.apk sampleapp.apk C:\Users\Family\workspace\keytools\keys\anddev.keystore
I have also tried to run:
jarsigner -verbose -keystore C:\Users\Family\workspace\keytools\keys\anddev.keystore -signedjar C:\Users\Family\workspace\keytools\sampleapp_signed.apk C:\Users\Family\workspace\keytools\sampleapp.apk C:\Users\Family\workspace\keytools\keys\anddev.keystore
When i navigate to c:\program files\java\jdk1.6.0_23\bin and run that code it asks for the keystore password and when I write the keystore pass (123456), it gives me an error:
jarsigner: Certificate chain not found for: c:\users\family\workspace\keytools\keys\anddev.keystore. c:\users\family\workspace\keytools\keys\anddev.keystore must reference a valid Keystore key entry containing a private key and corresponding key certificate chain.
When i write anddev.keystore pass (=asdfgh, the second pass that keytool asked for at the end of the process) i get this error:
jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect. (However, i am pretty sure this is rightful error, cause the pass is not this, but the 123456).
I am pretty sure i am getting closer and that certificate chain error is the problem. Right? Am i missing a step or what?
One another thing: in the command line when keytool asked for any password the cursor was not moving. I wrote the password but i didn't see any numbers or stars, or the cursor moving. It then asked for a reenter password, same happened. I guess this is ok, and a feature of the command line, i am just writing this to be sure.
Edit:
Based on the help of Hades and Saasha, it was extremely easy to sign the apk. For anyone interested here are my steps:
For this i created a MyKeys folder into C:\Users\Family\workspace. After the process the sample.keystore and the samplesigned.apk appeared in that folder.
Hallo
If you using Eclipse you can try:
Compile and sign with Eclipse ADT
If you are using Eclipse with the ADT plugin, you can use the Export Wizard to export a signed .apk (and even create a new keystore, if necessary). The Export Wizard performs all the interaction with the Keytool and Jarsigner for you, which allows you to sign the package using a GUI instead of performing the manual procedures to compile, sign, and align, as discussed above. Once the wizard has compiled and signed your package, it will also perfom package alignment with zipalign. Because the Export Wizard uses both Keytool and Jarsigner, you should ensure that they are accessible on your computer, as described above in the Basic Setup for Signing.
To create a signed and aligned .apk in Eclipse:
Select the project in the Package Explorer and select File > Export.
Open the Android folder, select Export Android Application, and click Next. The Export Android Application wizard now starts, which will guide you through the process of signing your application, including steps for selecting the private key with which to sign the .apk (or creating a new keystore and private key).
Complete the Export Wizard and your application will be compiled, signed, aligned, and ready for distribution.
Don't go through all that trouble.
Are you using eclipse? If you are refer this guide.
http://developer.android.com/guide/publishing/app-signing.html
Scroll down to this heading,
"Compile and sign with Eclipse ADT"
It has a wizard for a keystore too.