Tag Archive for: Android

CordovaError: Requirements check failed for JDK 1.8 or greater

If you have a Cordova Error after updating to Ubuntu 18.04, the easiest way to resolve this issue is removing openjdk-11 and reinstalling openjdk-8.

sudo apt purge openjdk-11-jdk-headless openjdk-11-jre-headless
sudo apt install openjdk-8-jdk

There is not support for the new java versions yet in Cordova/Android (at the post date)

Get local html files (views/widgets) and insert them into your Cordova Single Page Application

Approach to load different views into an Android SPA.

  1. An index.html file with all the scripts, styles and so on.
  2. HTML, CSS and JS files at least as many as views in folders called view, css and js respectively and with the same names to not mess around. Ex: page.html, page.css and page.js
  3. We can use Axios to load views instead of the typical XMLHttpRequest that follows:

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.