Dealing with keystores and passwords when building for Android with Cordova

Which is the easiest way of builing apps in Android with Cordova?

Use a build.json file

{
     "android": {
         "release": {
             "keystore": "./your_keystore_file",
             "storePassword": "your_keystore_password",
             "alias": "your_alias_name",
             "password" : "your_alias_password"
         }
     }
 }

And type in your console: cordova build android –release

If you already have a keystore and don’t know what alias to use, run the command: keytool -list -v -keystore YOUR_KEYSTORE_FILE to see all the available aliases.

Keystore only has one password. You can change it using keytool: keytool -storepasswd -keystore MY_KEYSTORE

Note: I’m locating my build.json and keystore_file in my project’s root folder.

Scroll into view

I have created n boxes (divs) with random colors to select one of them randomly and make it visible on the viewport. Every time you rerun the code you will see in your screen the selected box regardless of its position.

Flattening arrays of objects

Starting from the previous example we are going to flatten arrays of objects with 3 method:

  • map with join
  • forEach with concat
  • forEach with push


We are trying to do it in a functional way, clearer and shorter. The more (nested) elements you have, the better the map option will be versus forEach with concat. If we are looking for the fastest option, a classical for with push will be the best one as JapanFever said and the worst a forEach with concat.

Just launch these basic test I made in jsPerf and try yourself:

https://jsperf.com/map-with-join-vs-foreach-with-concat

https://jsperf.com/flattening-arrays-of-objects

The more (nested) elements you have, the more equal the forEach will be comparing with the classical for.

JavaScript engines performance are improving constantly and I hope to see a better way to flatten using map xD

 

Nesting arrays of objects

Array without duplicate values