Sign an APK exported from Visual Studio 2015 - android

I am trying to post an app created through Apache Cordova using Visual Studio 2015. I have been able to export the .APK successfully but I have not been able to find a keystore in order to sign this .APK so I can post it.
I can not find a keystore anywhere in the Visual Studio project build and whenever I try to run the CMD it says that I have an "Illegal Option: aaaa-key.keystore keytool -genkeypair" and doesn't generate a Keystore.
If there is no Keystore generated by the IDE (that I could find) and my CMD isn't creating one as instructed from MSN then I feel kind of stuck. Please help.

You can generate a new key with this command:
First open cmd and then type:
cd C:\Program Files (x86)\Java\jdk1.7.0_55\jre\bin
Then run:
keytool -genkeypair -v -keystore YourKeyName.keystore ^
-alias YourKeyName -keyalg RSA -keysize 2048 -validity 10000

Related

how to import jks file in visual studio 2019 as existing keystore

I want to update an App on Google Play. I lost the Keystore password, after contacting google support I followed the below-given commands, and they reset the upload key for me.
1. keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
2. keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Now I have the keystore.jks file. Now here Problem comes.
I am following these steps in Visual Studio 2019.
Right-click on Myproject.Android > Archive then getting apk file Bundle Format: apk
Click Distribute > Google Play > Import
then Import an Existing Keystore dialog box it is expecting with an extension of .keystore file to import but I have .jks tried to convert it to .keystore as well but not succeded.
Here is the error I am getting
at Xamarin.AndroidTools.PublicationUtilities.KeyManagement.<>c__DisplayClass13_0.<ImportKeyAsync>b__0(Task`1 t) in C:\A\1\34\s\External\androidtools\Xamarin.AndroidTools\PublicationUtilities\KeyManagement.cs:line 313
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.VisualStudio.Publishing.Presentation.ViewModels.AndroidImportKeyViewModel.<Import>d__48.MoveNext() in C:\A\1\34\s\src\Core\VisualStudio.Publishing\Presentation\ViewModels\AndroidImportKeyViewModel.cs:line 133
Is there anything I am missing?
How I can use keystore.jks to update my App?
I thought I should post how I resolved this issue if someone else would be facing this issue he might solve it by following these steps.
After getting keystore.jks file copy your project.Android.apk and keystore.jks files to C:\Program Files (x86)\Android\android-sdk\build-tools\30.0.2 location.
run Command Prompt as administrator in given location C:\Program Files (x86)\Android\android-sdk\build-tools\30.0.2
Now you need to zipalign the apk file manually, run the following commands.
run zipalign -v -p 4 com.project.Android.apk com.projectAligned.Android.apk
then you have to sign apk.
apksigner sign --ks keystore.jks --out com.projectRelease.Android.apk com.projectAligned.Android.apk
I ran into the same problem with the Visual Studio keystore import tool and it turns out the import tool requires a non-empty password for the alias as well as the keystore. Here's how you can copy the keystore.jks file to a new upload.keystore file with the alias password required by the import tool:
keytool -importkeystore -srckeystore keystore.jks -srcalias upload -destkeystore upload.keystore -deststoretype pkcs12 -destalias upload -destkeypass password
Now you can use Visual Studio to import the newly created upload.keystore using the alias password you specified for -destkeypass above and use Visual Studio to sign as usual rather than signing from the command line.
I had the same issue with one app, and the easiest solution with Visual Studio was:
Create a new keystore file with Visual Studio, after that you can find it at:
C:\Users\USERNAME\AppData\Local\Xamarin\Mono for Android\Keystore\alias\alias.keystore
Once you have the new key, use keytool to generate the certificate from that file:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore alias.keystore
The new certificate (.pem) will be in the same folder, and the .keystore file works just as the .jks that Andoid Studio usually generates but it's better with Visual Studio. This way no realigning is necessary.

i have an issue with building appbundle with flutter

i'm trying to prepare my app for publishing to play store, bur while i'm creating the app bundle, this error shows up too many times, i was recreate the keystore but it's failed again,
i want to mention that when i setup keystore it's asks me for keystore password just without keypass
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ ]
> Failed to read key key from store "/Users/ahd/key.jks": Invalid keystore format
I had this issue and it was because of the version of Java I was using. I used the keytool within Android Studio to generate the keystore instead and this fixed the issue for me.
Run flutter doctor -v and look for the "Java binary at:" entry. Then use this path swapping 'java' for 'keytool' to generate your keystore. For example
/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
In my case I also followed the recommendation that popped up at the end of this to migrate to PKCS12 (once again using the keytool in Android Studio).

dreamweaver does create key sign for Android apps?

I created some web pages with html css and jquery, and I want to convert it to Android apps.
so I download android SDK and using Adobe dreamweaver 5.5 to create my apk file.
it was created and i installed on my phone without any problem. but when I want to upload my apk file to android stores I have a message that: program should not be on debug sign.
How can I remove debug sign or create a my own sign?
You just have to create the key with keytool using the command line (in windows : cmd.exe)
Here is the guide how to do it (scroll down to "1. Obtain a suitable private key")
Depends on how you are signing. Command line with Keytool
or Using Android studio. both ways are easy
For android studio I recommend reading here
For the Keytool method its
$ keytool -genkey -v -keystore my-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

Cordova ionic create Android App Keystore

I made the application using Ionic Cordova
Now I want to assemble it and suggested that I create a key at the assembly stage.
On the official site it offers to execute the command in the console
$ keytool -genkey -v -keystore MY-RELEASE-
KEY.keystore -alias MY_ALIAS_NAME -keyalg RSA -keysize 2048 -validity 10000
but where exactly should it be performed?
In what directory is the nada?
Do I need to install android SDK or android Studio.
Who had the experience of building applications, tell me how to do everything correctly
Keytool and jarsigner comes with the java jdk. You can run it wherever you want.
The zipalign tool can be found in /path/to/Android/sdk/build-tools/VERSION/zipalign. For example, on OS X with Android Studio installed, zipalign is in ~/Library/Android/sdk/build-tools/VERSION/zipalign
Just follow everything here. Of course you need JDK
https://ionicframework.com/docs/v1/guide/publishing.html

Android - PhoneGap application (keystore file error)

I am developing a PhoneGap application through Eclipse on the Android platform. My code is ready and run perfectly.
Now, I already created a signed APK file in release mode. So, when I uploaded this keystore file on "build.phonegap.com", and clicked on Submit key, I got an error like this:
Error: extension did not match expected (keystore)"
I don't know what is going wrong in this. Is there a proper solution?
A command-line solution:
keytool -genkey -v -keystore yourappname.keystore -alias appnamealias -keyalg RSA -keysize 2048 -validity 10000
According to: This Post
When you are creating your keystore file in Eclipse make sure to manually set the file extension to ".keystore" - instead of the default file name with no extension.
What tools do we need to develop an Android keystore file?
The Android keystore file can be created in the Java Development Kit (JDK), and to download the installation file, click on this link: Install JDK.
How do we create the Android keystore file?
Standard procedure: First you need to open the command prompt as administrator
To go from a directory to its parent directory, write cd.. (push the Enter button). Keep doing it until you reach c:>.
When you are at c:/, write cd Program files (push the Enter button).
cd Java (push the Enter button).
cd jdk1.7.0_03 (push the Enter button).
cd bin (push the Enter button).
**keytool -genkey -v -keystore Your_personal_file_title.keystore -alias Your_personal_alias -keyalg RSA -keysize 2048 -validity 10000** (push the Enter button).
Remember to edit the two text file Your_personal_file_title and Your_personal_alias.
And enter your profile information.
Afterwards it will create your Android keystore file in your C:\Program files\Java\jdk1.7.0_03\bin directory, with the name you gave it…
You now have your keystore file and can activate it in whatever application you generate your Android apps in (for example, build.phonegap.com).
Please remember to use CMD as administrator.
You need to create your own .keystore file. To do this:
Open CMD
Type:
cd C:\java path\java\jdk7\bin
keytool -genkey -v -keystore yourappname.keystore -alias appnamealias -keyalg RSA -keysize 2048 -validity 10000
After that you will have a new release keystore.

Categories

Resources