Cordova CLI Builder

Description

Alpha Anywhere includes a CLI build option in the Cordova App Builder. Support is provided for Android builds on a Windows PC, Android builds with a Docker container and iOS builds on a Mac.

Discussion

The Cordova CLI Builder allows Android apps to be built on a local development machine, or built with a Docker container.

The advantage of building on a local development machine is that the build process is faster. The drawback is that the developer must install and properly configue a number of tools to build the app. This is time consuming and prone to errors.

This documentation was last updated in June 2024 and is applicable to Alpha Anywhere Version 12.4.6.5.6 Build 9192 or greater.

Building Android Cordova Apps with a Docker Container

One of the challenges of building Cordova Android apps on a development machine is the requirement to install and configure specific versions of Node.js, Java, Gradle, Cordova and the Android SDK. Even for a very experienced developer, it can take a full day to get everything configured properly. Building from a Docker image in a Docker Container resolves this problem.

The latest version of the Cordova CLI Builder allows a developer to build an Android app using a Docker image that was specifically created for use with Alpha Anywhere and the integrated Cordova App Builder genie. A Docker Image is essentially a blueprint for a Docker Container. A Docker image runs in a Docker container. The Docker container includes all of the required versions of Cordova, Node.js, Java, Gradle and the Android SDK.

See: Docker Overview for an introduction to Docker.

Building an app with a Docker Container on a Windows machine requires the installation of:

Once Docker Desktop for Windows is installed, do a search on Docker Hub for the alpha-cordova-android-build Docker image. Once found, pull down the latest image into Docker Desktop. The latest image supports Cordova Android 13, API level 34. You only need to do this once or anytime that a new alpha-cordova-android-build image is created and made available on Docker Hub.

images/docker/dockerDesktopSearch.png

Once the image is loaded into Docker Desktop, as shown below, the Docker Image can be used by the Cordova CLI Builder. Docker Desktop can be left running in a minimized window.

Each time you wish to build an Android app with Docker, make sure to have Docker Desktop loaded prior to launching the Cordova CLI Builder so the Docker Image can be found.

images/docker/dockerDesktopImage.png

If you would like to install the Android app on an Android device that is connected to the development computer after the build completes you need to install the Android Debug Bridge (ADB) utility for Windows.

See: Download and install Android SDK Tools

Prior to launching the Docker Container, make sure the ADB utility can see the connected Android device. To do so, launch a terminal window and enter ADB at the command prompt. You should see the device listed.

To start the Docker build process, from within the Cordova CLI Builder, check the property highlighted below.

images/docker/buildWithDockerV2.png

When all of the app files are generated, the prompt below will appear:

images/docker/runDockerImagev2.png

Select the Yes button to start the Docker Container and you will be launched into a Linux Bash terminal where the Cordova Android build process will start and complete. When the app build process is completed, the Linux terminal window will remain displayed.

At this point the Cordova Android app has been built and all of the files are in the Windows project target folder as well as within the file system of the Linux container. You can see the location of the APK file in the containers file system in the image below:

images/docker/dockerBuildSuccessful.png

The APK file can be found within the Windows project target folder at targetDriveDirectory\projectname\platforms\android\app\build\outputs\apk\debug.

To install and run the app on an Android device that is connected to the computer and seen by ADB, enter:

run android --nobuild

at the Linux command prompt.

To close and remove the container, enter

exit

at the Linux command prompt.

This removes the Docker Container instance and all of the files associated with it. The Windows Cordova project files remain. The Docker image remains installed within Docker Desktop for continued use. You do not need to download the image once again unless it is updated to handle a revision to Cordova Android or the Cordova Android support files.

Building with a local development machine

For Android, the build scripts will build an Android APK file, installing all requested plugins. Options are provided to install the APK file on an Android device through the USB debug cable, by scanning a QR Code or the APK can be uploaded to the cloud so that it could be shared and installed by a group of test users.

If you plan to publish your app to the Google Play Store, make sure to install Cordova 12.0.0 or later. This is required to support Android SDK 33 (a requirment as of August 2023) which is the earliest release of the Android SDK that is supported by Cordova Android which meets the requirements for Google Play Store app submission.

If you have a previous version of Cordova installed, refer to the section on updating Cordova.

For iOS apps, the builder will package up all of the required app files into a zip file and generate a Bash shell script to build the Cordova App on a Mac.

The Cordova CLI provides a command line interface for creating Cordova apps. It is supported on OSX and Windows development machines and requires the developer to install the Cordova CLI and the native app developer tools on the development machine.

If you want to build iOS apps using the Cordova CLI, you will need a Mac with the Cordova CLI and Xcode installed. You will also need an Apple Developer Account.

To develop Android apps on a Windows PC you will need to install the Java SE Development Kit (JDK), NodeJS, Gradle, Android Studio, and the Cordova CLI.

The steps below cover the installation of the latest release of Cordova and Cordova Android 13.0.0, API Level 34 as of June 2024.

Windows PC Android SDK installation and setup for deploying Cordova Apps

This release includes support for Cordova Android 13.0.0, API Level 34, which has breaking changes when compared to the previous release, Cordova Android 12.x.x.

  1. Install the JDK 17

  2. Install Git

    • a. Follow the installation instructions here.

  3. Install Node.js

    • a. Download the installer from NodeJS

      Node 12 is no longer supported. As of August 2022, the LTS version of Node is v16 and should be the minimum version installed.

      Node.js needs to be added to the PATH environment variable, which is done by default.

    • b. To test the installation, open up a new command window and type:

      node --version

      The version number should be displayed.

      You can open the command window from within Alpha Anywhere by clicking the Open Windows CMD Window button in the toolbar on the Web Projects Control Panel.

  4. Install Gradle

    • a. Download the latest release of Gradle from Gradle.org

      Gradle is an open source build system that is required by Android Studio.

      Create a gradle directory off of the C: drive root and install the downloaded version into it's own directory.

      In the image below the gradle folder includes two (2) different versions. Environment variables will be defined in later steps to indicate the version that will be used for Cordova Android builds.

      images/android13/gradle_directory.png
  5. Install Cordova

    • a. From a command window, enter the following:

      npm install -g cordova

      b. To verify proper installation, from the command window enter:

      cordova -v

      The cordova -v command displays the version of Cordova that is installed.

      As of June 2024, the latest Cordvoa CLI release is 12.0.0

  6. Install Android Studio

    Cordova Android 13.0.0 requires at a minimum, Android Studio Jellyfish but the latest release, Android Studio Koala can also be used.

    • a. See: Install Android Studio

    • b. After installing Android Studio, you must install the packages for the the API you wish to target. Locate the SDK Manager icon in the upper right-hand corner of Android Studio.

      images/android13/Launch_Android_SDK_Manager.png
    • Select the target platforms on the SDK Platforms tab and click OK. If you plan to deploy your app to Google Play, make sure you meet Google Play Store Requirements for the minimum SDK version. As of June 2024, the latest API level supported by Cordova Android is Android 14 API level 34 (UpsideDownCake).

      images/android13/Android_34_SDK_Platforms.png
    • See Android Studio's Update the IDE and SDK Tools help article for more information.

    • Cordova Android 13 requires Android SDK Build Tools version 34.0.0

      For earlier versions, Cordova Android 12 requires SDK Build Tools 33.0.2 and Cordova CLI 10.x.x and Cordova CLI 11.x.x that targets Cordova Android 10.x.x requires Android SDK Build Tools version 30.0.3, which is neither the latest release nor installed by default. To install the Android SDK Build Tools version 30.0.3, from within Android Studio click Tools < SDK Tools. Click the Android SDK Tools option. The status may indicate an update is available, however, the update will most likely not work with Cordova. Check the Show Package Details box in the lower right corner to display all available developer tools.

    • Check Android SDK Build Tools 34.0.0 (when using Cordova Android 13) or Android SDK Build Tools 33.0.2 (when using Cordova Android 12) or Android SDK Build Tools 32.0.0 (when using Cordova Android 11) or 30.0.3 (when using Cordova Android 9 or Cordova Android 10). You can install both SDK Build Tools if you prefer. When installation of Android SDK Build Tools completes, you will be able to build Android Cordova apps with the Alpha Cordova CLI Builder Genie and Android Studio.

      images/android13/Android_34_SDK_Tools.png
    • Scroll down to install the latest version of the Android SDK Command Line Tools

      images/android13/Android_34_Command_Line_Tools.png
  7. Set the Environment Variables

    • The Cordova CLI installer attempts to set the required environment variables. However, in certain cases, variables need to be set manually. In Windows, the steps to set the environment variables are dependent on the installed version of Windows. You must close and open any command prompt windows after making the changes for the changes to take effect.

      1. Click on the Start Menu in the lower left corner of the desktop.

      2. In the search bar, search for Environment Variables and select Edit the System Environment Variables.

      3. In the window that appears, click the Environment Variables button.

        images/android13/SystemEnvironmentVariables.png
      4. Click New... and enter the variable name and value.

      5. Set the GRADLE_HOME environment variable to the location of the installed Gradle version that should be used for Cordova Android builds.

        images/android13/set_gradle_and_java_home.png
      6. Set the JAVA_HOME environment variable to the location of the JDK 17.0 installation.

      7. Set the ANDROID_HOME environment variable to the location of the Android SDK installation.

        images/android13/AndroidHome.png
  8. Edit the System Path

      1. Select the Path variable and click Edit.

      2. Add the following entries:

          1. %JAVA_HOME%\bin

          2. %ANDROID_HOME%\platform-tools

          3. %ANDROID_HOME%\cmdline-tools\bin

          4. %GRADLE_HOME%\bin

        images/android13/android_edit_system_path.png

Verifying the Android Cordova CLI Build Environment on Windows

The Android CLI Build - Setup dialog can be used to verify the environment and PATH variables are correct. To access the dialog:

  1. In Alpha Anywhere, click the Open Cordova Project Builder tool on the Web Projects Control Panel.

  2. Next, click Save & Launch Cordova CLI Builder.

    The Save & Launch Cordova CLI Builder button is only available when the App Build Target is set to "CLI", Android or iOS is checked, and Initial UX Component is set.

  3. On the Cordova CLI Project Build Properties, check Generate Android Build. This will expose the Check to see if your computer is correctly configured for Android CLI builds link.

  4. Click Check to see if your computer is correctly configured for Android CLI builds to check that your environment and PATH variables are setup correctly.

    Android CLI Build - Setup dialog
    Android CLI Build - Setup dialog
  5. Click Cancel in the Cordova CLI Project Build Properties dialog to return to the Web Projects Control Panel.

Review the information in the dialog. If an environment variable is missing or something is missing from the PATH, review the [Windows PC Android SDK installation and setup for deploying Cordova Apps] section above for instructions on how to setup your environment.

Mac OSX Cordova Installation

  1. Install Xcode (if not previously installed)

  2. Update iOS-deploy

    • The latest version of iOS-deploy is required if you plan on using the Xcode CLI tools to build and install the app on a simulator or a device.

      To update iOS-deploy, open a terminal and enter:

      sudo npm install -g ios-deploy@latest --force
  3. Install Node.js

    • a. Download the installer from https://nodejs.org/

      /usr/local/bin needs to be added to the PATH environment variable, which should done by default. To verify, enter echo $PATH from Terminal.
    • To test the installation, from Terminal, type node --version The version number should be displayed.

  4. Install Cordova

    • a. From a Terminal window, enter npm install -g [email protected].

    • b. To verify proper installation, from a Terminal window enter cordova -v, the installed Cordova version will be displayed.

Upgrading Cordova

To upgrade an existing installation of Cordova:

  1. Open a console window. On Windows, open Command Prompt. On Mac, open Terminal.

  2. Uninstall Cordova. Run the following command in the console window:

    npm uninstall -g cordova

    Mac may require the sudo command. E.g. sudo npm uninstall -g cordova.

  3. Install the latest release of Cordova. Run the following command in the console window:

    npm install -g cordova

    You can optionally specify a specific version of cordova to install using cordova@version where version is the version number. For example, to install Cordova 12.0.0, run the following command in the console window:

    npm install -g [email protected]

    Mac may require the sudo command. E.g. sudo npm install -g cordova.

Using the Cordova App Builder

From the Cordova App Builder, it is best to start a new Cordova Project to make sure you are using the latest project template files. Project template files change from time to time based on device operating system revisions or revisions to Cordova. Set the App Build Target to CLI.

images/android13/Cordova_App_Builder.png

The Cordova App Builder supports the latest release of Cordova iOS, version 7.1.0. This release is required if you wish to publish your iOS app to the App Store.

Cordova iOS 7.1.0 includes the required WKWebView. It does not require the installation of the older Alpha WKWebView Plugin.

The options within the Cordova App Builder will be updated to reflect the options that are applicable to a CLI build. Make sure to specify the Application ID properly. The Application ID uses reverse domain naming notation and the CLI app folder created will use the app name specified in this string. For example, if the application id is com.alphasoftware.test1, then the CLI project folder created will be test1. Spaces are not allowed, and the name is automatically converted to lower case, per Android conventions.

Cordova version 12 is required to build iOS apps with Cordova iOS 7.1.0. To update the Cordova CLI version see Upgrading Cordova.

Configure the rest of the options for your application.

You can select a custom app icon (make sure to use a 512px x 512px image) and splash screen or launch image. If nothing is specified, a default icon and splash screen is used.

If you are building an Android App using Cordova Android 13, a single splash screen at a resolution of 2732px x 2732px is required. If you do not specify a Cordova Android 13 splash screen image a default image will be automatically created. The path to this image will be displayed on the 2nd and subsequent invocations of the Cordova App Builder.

The splash screen handling has changed significantly for Cordova Android 11+. All Android related splash tags in the config.xml file are deprecated and will be removed. The splash screen plugin is also incompatible with Cordova Android 11+ and will be automatically removed if it is enabled.

Cordova Android 11+ requires all apps to use the https protocol for proper operation of ajax callbacks, session vars, session files and cookies. The Alpha Server must have a valid certificate and a valid domain name.

The Alpha Server must have the Advanced /Sessions / Same Site Mode value set to None (requires use of HTTPS).

Within the Cordova Project Settings, the Host Scheme must be set to https and the Host Name Preference must be the domain name.

images/android11/android-host-preference.png

Specify all of the required plugins for your application. If you are using any plugins that require you to insert a hook, you will need to build the CLI version of the app and then edit the generated source code to include the hook per the plugin documentation. You can then run the Cordova CLI Builder again and update the app.

Once all of the options have been set, select the Save & Launch Cordova CLI Builder button. The Cordova CLI Project Builder Window will appear.

images/pg_cli2.PNG

The Cordova CLI Builder

images/android13/Cordova_CLI_Builder_r1.png

Build Specifications

The first step is to specify the Target Project Build Folder. This will be the root folder for the CLI generated files. If you have specified an Android build, a subfolder will be created with the name of the app ID. If you have specified an iOS build, an iOS files subfolder will be created with a naming convention of appid_iOS_Files. The generated iOS files need to be transferred to a Mac to build an iOS App

Generate Android Build - Check this option to build a Cordova CLI Android project. Once checked, additional Android project related options will appear.

Generate iOS Build - Check this option to package up all of the app files and generate a BASH script for building a Cordova project on a Mac.

Android Build Options

Update Existing App - If checked and an app with the same app id exists within the target project build folder, then only the /www folder will be updated. This allows you to make changes to the base component and update the app quickly. If this option is unchecked and an existing app with the same app id exists within the target project build folder, then all of the app files are deleted and a new project is built. This includes the installation of all plugins.

Update All Plugins - Enable this option if the Update Existing App option is checked and you have added a new plugin to the project.

Include/Update Custom App Icon or Launch Image - If you have generated and included a custom icon or a custom launch image (splash screen), this option needs to be enabled at least once to copy the icon and launch images to the appropriate Cordova Android platform specific folders. This only needs to be done once, so if you are updating an existing app, you can save time by disabling this option on subsequent updates.

Android Build Type - The build type can be either a Debug Build or a Release Build. For development and testing, use a Debug build. When you are ready to deploy the app to Google Play or through an Enterprise Mobile App Manager, use a Release Build. Release Builds must be signed with the appropriate developer credentials. When you select a Release Build, the Credentials and Options For Signed Release Build category is shown.

images/android11/cli-builder-debug.svg

Production Android App Credentials

Before you begin, review the Android app signing requirements: https://developer.android.com/studio/publish/app-signing.html

Keystore - Select the binary file that holds the set of keys.

Keystore Password - Password to the keystore.

Alias - The ID specifying the private key used for signing the app.

Password - Password for the private key specified.

Keystore Type - Default is auto-detect which is based on the file extension. You can also select the specific pkcs12 or jks extension.

images/android11/android-release-build.svg

Post APK Build Behavior

The options in this category determine the actions that take place after the Android Cordova project is completed and the APK file is generated.

Show QR Code To Install APK With Scanner - If you would like to install the app on an Android device, enable this option to generate a QR Code that can be scanned to install the APK file. The generated APK file will be copied to the development server (which must be running) and stored in a folder called apk_files/appID (the name of the app).

Install On Device Or Emulator - This option allows the app to be installed on an emulator (if one has been installed and configured) or on an actual device (if USB debugging has been enabled and the Windows device drivers are working properly). Android devices can be very tricky to setup with Windows due to the numerous device drivers available and large variety of Android devices and operating system versions.

Upload APK To Cloud Storage - If you would like to upload the APK file to storage, such as Amazon S3 or Azure, enable this option. Uploading the APK to storage makes it easy to share with others. The Cloud Storage Properties category will be displayed when this option is enabled.

images/pg_cli6.PNG

Cloud Storage Properties

Method for specifying credentials - You can specify the cloud storage credentials by selecting a Named Storage Connection String or Explicitly providing the credentials. If you select the Named Storage Connection String Option, the Storage Connection string property will appear, allowing you to select a previously defined storage connection string.

Storage connection string - This will be displayed if the named Storage Connection String option is selected above. Choose a storage connection from the dropdown. If no storage connection is listed, you can create one.

Access key - Displayed when the Explicit option for specifying credentials is selected. Enter your Amazon S3 access key.

Secret - Displayed when the Explicit option for specifying credentials is selected. Enter your Amazon S3 secret key.

Bucket - Displayed when the Explicit option for specifying credentials is selected. Enter the Amazon S3 bucket name.

images/pg_cli7.PNG

Generating Build Bundles for New Google Play Store Submission

If you are planning to submit your app to the Google Play Store, you must submit an Android App Bundle. As of August 2021, new app submissions to the Google Play store must include Android App Bundles. This requirement only applies to new apps submitted to the Google Play store.

App bundles are created using Android studio. Open the Android Cordova Project in Android Studio for your application and select Build > Build Bundle(s)/APK(s) > Build Bundle(s) from the Android Studio menu.

Android Studio Build Bundle menu
Android Studio Build Bundle menu

The Android Cordova Project for your app can be found in the projectName/platforms/android directory in the Target Project Build Folder. To open the project, select File > Open from the Android Studio menu. Navigate to the Target Project Build Folder, locate your project, then select the projectName/platforms/android directory.

Android Studio Open File or Project dialog
Android Studio Open File or Project dialog

Refer to Google Play Play Policies for more details about Google Play store app submission requirements.

Android Studio Gradle Plugin

Android apps may be built with Android Studio. To do so, launch Android Studio and open the Platforms/Android folder in the directory that contains the Cordova project files.

When opening the project, Android Studio may display a prompt, notifying you of a recommended update to the Android Gradle Plugin.

images/android-gradle-update-1.png

The Android Gradle Plugin (not to be confused with Gradle) is an Android Studio Plugin that provides additional functionality to Gradle when building Android apps.

The Android Gradle Plugin that works with current Cordova projects is 4.x.x. and it is specified and installed by the Cordova CLI builder. Newer versions will not work with the default Java version specified by Cordova. If you would like to update the Android Studio Plugin, you will need to modify Android Studio to use Gradle JDK Version 11.

If you do not want to upgrade and do not want to be prompted to upgrade the Android Gradle plugin every time you load the project, click the "upgraded" link, then click "Don't remind me again for this project".

images/android-gradle-update-2.png

if you want to upgrade the Android Studio Gradle plugin to the latest release, click the "Begin Upgrade button" and the Upgrade Assistant will guide you through the process.

images/android-gradle-update-3.png

Once the Android Studio Gradle is updated, the app will not successfully build until it is configured to use version 11 of the Gradle JDK.

images/android-gradle-update-4.png

To update the Gradle JDK, open the Android Studio Preferences < Build, Execution, Deployment < Build Tools < Gradle menu. Select version 11 for the Gradle JDK. Click the OK button. Your Cordova app will now build with the latest Android Gradle Plugin.

images/android-gradle-update-5.png

Feature Comparison, Cordova iOS versions 7.1.0, 7.00, 6.x.x vs Cordova iOS 5.1.1

Cordova iOS 7.1.0 is the latest official release for building Cordova iOS applications and it includes support for Xcode 15 and the iOS 16 SDK. The UIWebView code was removed and replaced with the required WKWebView. As such, it does not require the Alpha WKWebView plugin that is used for Cordova iOS 5.1.1 builds.

For further information on the changes made to Cordova iOS 7.0.0 see Cordova iOS 7.0.0 Blog Post

For further information on the changes made to Cordova iOS 7.1.0 see Cordova iOS 7.1.0 Blog Post

The iOS Security Manifest

As of May 1, 2024, Apple requires a privacy manifest file to be created for apps and third-party SDKs. The purpose of the privacy manifest file is to explain the data being collected and the reasons for the required APIs it uses.

Starting with [email protected], APIs are available for configuring the privacy manifest file from the projects config.xml file.

See the links below for a good starting point to learn about the iOS Privacy Manifest:

There are 4 major areas that an iOS app developer needs to consider:

  • NSPrivacyTracking
  • NSPrivacyTrackingDomains
  • NSPrivacyCollectedDataTypes
  • NSPrivacyAccessedAPITypes

This article provides a good foundation on the subject:

In a Cordova app, the privacy manifest is an application wide privacy manifest defined in the projects config.xml file. The developer needs to edit the config.xml file to add the entries that may be required for the app.

In general, the Cordova plugins that are used in the app may have the biggest impact on what needs to be included in the NSPrivacyAccessedAPITypes category.

If the plugin includes a privacy manifest within an iOS source code bundle, then those privacy manifests will be included in the Xcode generated app. Xcode will automatically merge the privacy manifests defined in an iOS bundle in the plugin source code. This makes it easy to install plugins that may need to specify entries in the NSPrivacyAccessedAPITypes category.

If a plugin you are using requires access to any of the API's that require an entry in the NSPrivacyAccessedAPITypes section of the privacy manifest and they do not include a privacy manifest in the plugin source code then it will be up to the developer to determine what API's are being used and why.

At this time, these are the API's that may require an entry in the NSPrivacyAccessedAPITypes section of the privacy manifest file.

  • File Timestamp API's
  • System Boot Time API's
  • Disk Space API's
  • Active Keyboard API's
  • User Default API's

See the link below for further information on describing the required API usage reasons.

To build an app for Cordova iOS 7.1.0, you'll need to create a new project within the Cordova App Builder to be sure to get the latest changes to the config.xml file which will include the privacy manifest entries as shown in the image below:

images/docker/cordovaAppPrivacyManifest.png

If the app is collecting any user data, then it is the responsibility of the iOS app developer to identify information explaining what your app does with the data that it collects.

Also, be sure that all four keys are defined even if there are no additions to an item. Apple requires all to be defined.

  • NSPrivacyTracking
  • NSPrivacyCollectedDataTypes
  • NSPrivacyAccessedAPITypes
  • NSPrivacyTrackingDomains

iOS Build Options

images/ios/iOS_Build_Options.png

Build Target

You have two Build Target options when generating build scripts with the iOS app builder: Xcode or Xcode CLI.

An Xcode build requires you to open the generated app in Xcode to build the app.

An Xcode CLI build uses the Xcode command line (CLI) tools to build, automatically sign and optionally deploy the app to a device or simulator.

images/ios_props.png

Build Target - Options are Xcode or Xcode CLI. If you would like to use the Xcode CLI tools, you must setup Xcode to automatically manage signing and provisioning. This allows Xcode to create and update profiles, IDs, and certificates. If Xcode CLI is selected, additional options are displayed.

For Xcode CLI builds, the following options will be shown:

iOS Build Type For development, select debug. If you are creating an app for submission to the app store, select release.

Install & Run App After Build - Check this option if you would like to install and run the app on a device or a simulator after the build is complete.

Deployment - If the install and run option is checked, you can optionally deploy the app to a simulator or an iOS device connected your Mac.

Simulator Requested - If you are deploying to a simulator, you can optionally request a specific simulator. Make sure the selected simulator is installed and listed in Xcode.

Code Signing Identity - The default value is iPhone Developer, which is used by convention. This value can be changed as required.

Development Team - This value is listed in the upper right hand corner of the Apple Developer Certificates, Identifiers, and Profiles page. The area is highlighted in red below. Visit https://developer.apple.com to create or sign in to your Apple Developer account.

images/apple_dev_cip.png

Package Type - Select development, enterprise, ad-hoc, or app store based on your IPA package type requirements.

Since iOS builds must be done on a Mac with Xcode installed, the Cordova CLI Builder will package all of the required application files into a zip file (all files and subdirectories contained in the Cordova project /www directory) and generate a Bash script (called build.sh) that builds the Cordova project on a Mac. All required plugins will be installed.

Files are generated in the specified project directory using the naming convention: appID_iOS_Files (appID will be replaced with your app ID).

After files are generated, copy them to your Mac in folder where you would like to build the Cordova project. Then, enter bash build.sh from a Terminal window opened within the folder where the files have been copied. The script will build the project within this folder.

Xcode CLI Builds

If you would like to use the Xcode CLI builds, you must setup at least one Xcode project to use automatic provisioning. Xcode will "remember" this setting and use automatic provisioning for any future Xcode CLI builds. To setup automatic provisioning, open the platforms/ios/appID.xcodeproj with Xcode. In the Signing and Capabilities tab, check Automatically manage signing. Make sure the Provisioning Profile is set to Xcode Managed Profile. Do this for Debug and Release builds. You will now be able to successfully build and install iOS apps using the Xcode CLI tools. This bypasses the requirement to open and build the app in Xcode.

For a video overview on using the Xcode CLI builder, see https://youtu.be/qzngU4SvC74

images/xcode_auto_provision.png

For Xcode Builds

Once the project files are created, the Xcode project may be opened in Xcode by double clicking the appID.xcodeproj file in the platforms/ios folder (where appID is your app id).

You can now build the project in Xcode and install, run, and test on the iOS simulator or any iOS device provisioned for development on your Mac.

If you have included new plugins, you can either delete the existing Xcode project and run bash build.sh script again, or you can install the plugins with the Cordova CLI command cordova plugins install nameOfPlugin entered from the project root folder in Terminal.

  • Updating an existing Xcode project - If the Xcode project exists and you have made a change to any of the app files within Alpha Anywhere (such as modifying the base component), run the CLI builder again and copy the zip file over to your Mac. Extract the files into the platforms/ios/www folder, overwriting the existing files. You do not need to run the bash build.sh script a second time unless you have included new plugins.

For More Information

Cordova Android Platform Guide

For more information, review the Cordova Android Platform Guide.

See https://cordova.apache.org/docs/en/latest/guide/platforms/android/

Official Cordova Documentation

For more information on Cordova CLI development, review the official Cordova Documentation.

See https://cordova.apache.org/docs/en/latest/guide/overview/index.html

Videos

Alpha DevCon 2022: Keeping Up With Cordova

2022 Cordova Mobile App Development Presentation by Bob Moore, VP of Mobile Development, Alpha Software, Inc.

Nov 8, 2022