Quasar — Sign an APK while building
0. Observation — I’m a Windows Developer
This article is written by a Windows developer who hasn’t have a lot of knowledge regarding Unix based OS (Linux, Mac). But, if you’re a Linux/Mac dev, it is my hope that this bit of information, won’t stop you from reading this article.
In the last few months, I noticed many devs had questions on how to sign an APK generated by
Cordova with the help of
Quasar. When they are finally able to do it, the biggest complaint is about the time they spend doing all the required manual work.
What they usually aren’t aware of is, it’s possible to pass additional options to
Cordova while building with
quasar dev/build, and that opens a range of possibilities.
2. Creating the keystores
Our first step is to create the keystore itself. Not just one, but two keystores will be utilized. One will be used for the development environment and the other for the release environment. But to do that, we’ll need the JDK installed and your bin directory configured in your
Run the follow commands:
3. Quasar Project with Cordova Mode
If you’re familiarized with the
@quasar/cliand already know how to create a project and add
cordova mode, you can safely skip the following section.
Make sure you’re using the latest version of the
So run the follow command to create a new project:
Now is the time to install or update
cordova to the latest version:
And finally, add the Android Platform to your project:
4. Linking the Keystores
Now we need to create a
json configuration file. We'll call that build.cordova.json.
Once created, we’ll need to move the build.cordova.json, quasar-debug-key.jks and quasar-release-key.jks to the root directory of the project. Don’t forget to include them in the .gitignore
We need to modify the scripts section of the package.json in order to add two scripts: cordova:dev and cordova:build
Now, instead of running
quasar dev or
quasar build, you would run
yarn cordova:dev or
yarn cordova:build respectively.
6. Discovering the Fingerprint of the Keystore.
Our project is already running and signed (even while debugging), but if you’re planning to integrate your app with other apps (like Google or Facebook), they will request a fingerprint of your app/certificate.
In order to discover the fingerprint of our app, we would run the following command:
You’ll be able to see something like this:
That’s it! A faster way to sign your APK while building.
Let us know in the comments below, if this helped you, even if you are not on a Windows machine!
Interested in Quasar? Here are some more tips and information:
More info: https://quasar.dev
Getting Started: https://quasar.dev/start
Chat Server: https://chat.quasar.dev/