I'm trying to build the APK to post my plea on Ionic in the Play Store.
But when it comes to the command below I get the error:
PS C:\Projetos\XXX> jarsigner -verbose -sigalg SHA1withRSA
-digestalg SHA1 -keystore android.keystore platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk
android-app-key Picked up _JAVA_OPTIONS: -Xmx512M Enter Passphrase for
keystore: jarsigner:
unable to open jar file:
platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk
And the release is not generated in the APK folder. Can someone help me?
This problem may occur because of the following reasons :
app-release-unsigned.apk does not exist
when executing above command you are not in the release folder, release folder can be found in platforms/android/app/build/outputs/apk/release
keystore does not exist
Verify that you are following these steps
after running ionic cordova build --release android make sure the build is successful and release folder is created under, the path is platforms/android/app/build/outputs/apk/release.
once release folder is created navigate to that folder through terminal
once you reach there generate key store by running following command keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
you can change the key name to anything, in this example the key name is my-release-key, alias name is also up to you, here alias name is alias_name.
the key will be created under the release folder, save this key somewhere else to publish subsequent builds, also save alias name.
Once key is created run jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore app-release-unsigned.apk alias_name here put the same alias name in place of alias_name and keystore name in place of my-release-key.keystore what you choose in step 4, make sure you release apk name is same as app-release-unsigned.apk if it is different change it as well.
in the end run zipalign -v 4 app-release-unsigned.apk myapp.apk, to compress you app, this will create the compressed apk with name myapp.apk it is the same apk that you will use to publish.
Checked whether android.keystore is located in C:\Projetos\XXX directory. Also check app-release-unsigned.apk is present on platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk this path.
I was typing the wrong command. The correct one to generate is
ionic cordova build --release
and then, to generate the key for the first time, I used these commands:
keytool -genkey -v -keystore xxx.keystore -alias xxx-app-key -keyalg RSA -keysize 2048 -validity 10000
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore GestaoDespesas.keystore platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk xxx-app-key
.\zipalign -v 4 platforms\android\app\build\outputs\apk\release\xxx.apk xxx.apk
Related
I am trying to install a client certificate in my JVM to call a https soap service, but when running the
keytool -import command I get the below error:
**
keytool error: java.lang.Exception: Certificate not imported, alias already exists
**
Here is the command I am using, please note I am using Java11
**
C:\Softwares\java-11-openjdk-11.0.7.10-1.windows.redhat.x86_64\lib\security>keytool -import -keystore cacerts -file "C:\Softwares\client.certificate.pfx"
**
Please suggest.
Every entry in the java keystore is identified by a key called alias. It has to be unique for a given keystore. If you don't provide one, the default value the keytool uses is mykey. Looks like there is an entry with mykey already in your keystore. All you have to do is give a name yourself. You can do this using the alias attribute, like this:
keytool -import -keystore cacerts -file "C:\Softwares\client.certificate.pfx" -alias third_party_ca
You can use any name as long as it is unique.
Hi i am currently trying to create a signed apk for a flutter app but I've encounter a problem. Based on official docs https://flutter.dev/docs/deployment/android " Note: The keytool command might not be in your path—it’s part of the Java JDK, which is installed as part of Android Studio. For the concrete path, run flutter doctor -v and locate the path printed after ‘Java binary at:’. Then use that fully qualified path replacing java (at the end) with keytool." and ive check and thats really my situation, now my question is how can i change the location "C:\Program Files\Android\Android Studio\jre\bin\java" to "C:\Program Files\Android\Android Studio\jre\bin\keytool". Thanks for any answer coz i have already search how exactly to do that but failed.
I have found a solution: Simply enter these into Windows command prompt.
italic bold cd C:\Program Files\Java\jdk1.7.0_09\bin
following: How can I find and run the keytool
Yeah Dude I actually solved it my own, I just read the https://flutter.dev/docs/deployment/android again it seams that I didnt change the keytool -genkey -v -keystore c:/Users/USER_NAME/key.jks (<-This is the problem, there is no path on my PC with that name, so just change it) -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
To solved this issue:
Use this command keytool -genkey -v -keystore c:/Users/USER_NAME/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key and change the c:/Users/USER_NAME/ with an actual directory.
Unable to get SHA1 key, it is showing error about path, Keystore file doesn't exist.
Tried multiple numbers of solutions,
I am using the following command
keytool -list -v -keystore c:\users\your_user_name\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
The keystore file does not exists, you have to create it yourself.
Here is the procedure : Generate android release and debug keystores
I had the same problem but I tried below command and interestingly it worked for me under Windows 10.
keytool -list -keystore debug.keystore
My keystore is deleted, and I try to chat with Google playstore developer and I ask that my keystore app be reset, then they sent instructions like this:
Alternatively, you can use the following command line to generate a
new key:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
This key must be a 2048 bit RSA key and have 25-year validity.
Export the certificate for that key to PEM format:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Reply to this email and attach the upload_certificate.pem file.
My question is how to Export the certificate for that key to PEM format?
I try to using keytool.exe in folder C:\Program Files\Android\Android Studio\jre\bin the command prompt keytool.exe can not been write (force close)
keytool is provided in JDK, not JRE. You can install a JDK 1.8 for example and use keytool command from the path C:\Program Files\Java\JDK_1.8\bin\keytool.exe in Windows CMD terminal in Administrator mode(preferably).
The commands you provided are meant to generate a keypair and to export the certificate. So, if you have a proper keytool installed, you can execute your commands successfully and export the certificate.
For exporting certificate, if path not given it will export the ceritificate in bin folder.
I have created a project in eclipse and while trying to build the project from command prompt the following is asked:
[signjar] jarsigner error: java.lang.RuntimeException: keystore load: C:\Documents
and Settings\Gopakumar\.keystore (The system cannot find the file specified)
[signjar] Enter Passphrase for keystore:
BUILD FAILED
D:\Score\build.xml:556: The following error occurred while executing this line:
D:\Score\build.xml:147: jarsigner returned: 1
I have created keystore file using keytool in the project directory, exactly where build.xml resides.
But it doesn't prompt for the passphrase?
Try it:
Make a StoreFile with "keytool" command:
keytool -genkey -keystore YourKeyStoreFileAtPojectDirectory -storepass YourPassStoreString -keyalg rsa -alias YourKeyString -keypass YourPassKeyString -validity 99999 -storepass YourPassStoreString -dname "cn=XXYYZZ, o=XXYYZZ, l=YourCity, S=YourState, c=YourCountry"
and put the signjar block below in your build.xml:
<signjar destDir="signed"
alias="YourKeyString"
keypass="YourPassKeyString"
keystore="YourKeyStoreFileAtPojectDirectory"
storepass="YourPassStoreString"
digestalg="SHA1"
sigalg="MD5withRSA"
>