Cordova & Ionic issues

This document gives an overview of the most frequent issues with Cordova and Ionic projects as well as provides instructions for resolving them.

You may be looking for an answer regarding the following:

How to specify Cordova & Ionic versions

There are two equivalent ways to set both Cordova and Ionic versions:

  • using environment variables NC_CORDOVA_CLI_VERSION and NC_IONIC_CLI_VERSION, for example NC_CORDOVA_CLI_VERSION=~7.0.0,
  • in devDependencies section of your package.json, as can be seen in this example package.json.

Note that for both ways we support the npm's semver notation.

The desired versions will be installed right after the post-clone script and they'll be available by the time the pre-build script is executed.

Building for Android fails

If your Android build fails with the error message described below, it might be caused by outdated Cordova Android plugin.

Error: Could not find gradle wrapper within Android SDK.
Might need to update your Android SDK.

Android SDK version 26.0.x introduced some structural changes that were not compatible with Cordova Android <= 6.2.1. To overcome this issue, please use Cordova Android plugin version 6.2.2 or higher. For that you just need to specify

<engine name="android" spec="6.2.2"/>

in your config.xml file as described in Cordova documentation.

Please also note that this requires the use of Cordova 6.5.0 or newer. In case Nevercode uses an earlier version of Cordova for your project, you can force Nevercode to use your desired version by setting the NC_CORDOVA_CLI_VERSION environment variable (as shown here). For example, if you'd like to use Cordova 6.5.0, you'd have to define it as NC_CORDOVA_CLI_VERSION=6.5.0.

What commands does Nevercode use to build my Cordova app

For the sake of debugging your builds, it may be helpful for you to know what happens under the hood when Nevercode builds your Cordova project. The following commands are executed:

  1. cordova platform rm <platform>
  2. cordova platform add <platform>
  3. cordova build <platform> --<target> --device

If your project has multiple platforms, commands 1-3 will be executed once for each platform. In the 3rd command, <target> represents either debug or release, as per your build settings.

What commands does Nevercode use to build my Ionic app

For the sake of debugging your builds, it may be helpful for you to know what happens under the hood when Nevercode builds your Ionic project. The following commands are executed:

  1. ionic platform rm <platform>
  2. ionic platform add <platform>
  3. ionic build <platform> --<target> --device

If your project has multiple platforms, commands 1-3 will be executed once for each platform. In the 3rd command, <target> represents either debug or release, as per your build settings.

Nevercode cannot find my Cordova project or detects it as a native application instead

Important!

Once Nevercode has incorrectly detected the repository with a given platform (be it Android, iOS or Cordova or Ionic), additional rescans will not change the platform.

To try again, you must delete the existing app and add it from scratch.

The most likely cause is that your application does not meet the Cordova project structure requirements. You are probably making use of the npm, bower and gulp toolchain to template your project, which can throw Nevercode off because in that case the necessary files for proper detection are not in place when scanning the project.

The easiest way to fix this issue is to add a custom build step (a post-clone script, NC_POST_CLONE_SCRIPT) which installs the necessary dependencies and performs the extra tasks required for initializing your project.

Here is an example of a post-clone script which initializes a Cordova project.

#!/bin/sh

bower install
gulp

Nevercode cannot find my Ionic project or detects it as a native application instead

Important!

Once Nevercode has incorrectly detected the repository with a given platform (be it Android, iOS or Cordova or Ionic), additional rescans will not change the platform.

To try again, you must delete the existing app and add it from scratch.

The most likely cause is that your application does not meet the Ionic project structure requirements. You are probably making use of the npm, bower and gulp toolchain to template your project, which can throw Nevercode off because in that case the necessary files for proper detection are not in place when scanning the project.

The easiest way to fix this issue is to add a custom build step (a post-clone script, NC_POST_CLONE_SCRIPT) which installs the necessary dependencies and performs the extra tasks required for initializing your project.

Here is an example of a post-clone script which initializes an Ionic project.

#!/bin/sh
set -e

bower install
gulp

Nevercode cannot find any buildable Cordova projects

If you are getting the following error:

No buildable projects found from branch master :|

The most likely cause is that an Ionic project file exists in your Cordova project structure, which is the only distinguishing feature between Ionic and Cordova projects.

Cannot fetch Git URL over HTTPS

When you use a Git URL with the git+https protocol, you are likely to get the following build error:

fatal: Unable to find remote helper for 'git+https'

To overcome this issue, change the following path prefixes in config.xml and package.json as shown below:

git+https://... -> https://...
git+ssh://... -> ssh://...

Cordova & Ionic issues