Start tracking your progress
Trailhead Home
Trailhead Home

Set Up Your Hybrid Development Environment

What You’ll Learn

In this step, you’ll learn:
  • The software setup required for hybrid development.
  • How to check for preinstalled software.
  • How to install missing software.

Prerequisites

  • Successful completion of step 1, Install Common Requirements.
  • One of the following:
    • A Mac OS X development machine and successful completion of step 2, Install the Android Development Environment, or step 3, Install the iOS Development Environment, or both.
    • A Windows development machine and successful completion of step 2, Install the Android Development Environment.

About the Hybrid Development Environment

If you’ve made it this far, congratulations! You’re ready to create native apps for Android, iOS, or both. You’re also perfectly positioned to install the tools for developing Mobile SDK hybrid apps.

Hybrid development requires the Mobile SDK common software and at least one native development environment—Android on Windows; Android, iOS, or both on Mac OS X. If you jumped into this project here, without doing any of the previous steps, go back and start at step 1. Then continue to a native development installation before returning here.

Once you’ve installed either the Android or the iOS development environment, enabling the hybrid option is easy. The only missing pieces are the Cordova command-line interface (CLI) and the forcehybrid npm utility.

You can develop hybrid apps on either Mac or Windows development machines, but you can’t do in-depth iOS development on a Windows machine.

Install Cordova and Forcehybrid

  1. To check if Cordova is already installed, type at the OS command prompt: cordova -version
    • If this command reports version 8.1.2 or later, proceed to step 6. If it reports an earlier version, continue to the next step.
    • If you get a “command not found” error message, continue to step 3.
    • If Cordova prompts you to configure telemetry, type cordova telemetry off or cordova telemetry on
  2. Remove the existing version.
    1. On a Mac, type sudo npm uninstall -g cordova
    2. On Windows, type npm uninstall -g cordova
  3. Install the required version.
    1. On a Mac, type sudo npm install -g cordova@8.1.2
    2. On Windows, type npm install -g cordova@8.1.2
  4. When the installer finishes, type cordova telemetry off
  5. Return to step 1 to verify your installation.
  6. To install forcehybrid, run the npm install command.
    1. On Windows, type npm install -g forcehybrid and press Return.
    2. On a Mac, type sudo npm install -g forcehybrid and press Return.
  7. If prompted on a Mac, enter your system password.
  8. To test your installation, type forcehybrid version and press Return.
    $ forcehybrid version 
    forcehybrid version 6.0.0 
    $ 

    Your command-line printout should reflect the Mobile SDK version—currently, forcehybrid version 7.0.x.

Congratulations! If you’ve completed this step, you’re ready to create hybrid apps. To get started, use the forcehybrid create command and specify either hybrid_local or hybrid_remote as the app type.

Remember, if you installed only one native development environment, you can come back at any time to install the other one. Just check to be sure that your current Mobile SDK components are up to date with the versions listed in this project.

We won’t check any of your setup. Click Verify Step.

retargeting