Quasar — Sign an APK while building
By: Tobias Mesquita
Tags: Quasar, Cordova, Quasarframework, App Signing, Vue

Quasar — Sign an APK while building

Making your Cordova builds faster!

Note: This article was originally released on Dev.to.

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.

1. Introduction

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 Path .

Windows Path

Run the follow commands:

3. Quasar Project with Cordova Mode

If you’re familiarized with the @quasar/cli and 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 @quasar/cli :

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

5. Running

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:

Debug: 4E:96:80:2D:B8:C6:A9:44:D6:15:7B:FC:54:79:B6:45:C8:26:43:90

Release: 60:64:04:26:71:71:B4:AA:BC:1F:68:EC:2D:0B:59:06:A3:E5:2F:81

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

GitHub: https://github.com/quasarframework/quasar

Newsletter: https://quasar.dev/newsletter

Getting Started: https://quasar.dev/start

Chat Server: https://chat.quasar.dev/

Forum: https://forum.quasar.dev/

Twitter: https://twitter.com/quasarframework

Donate: https://donate.quasar.dev