Skip to main content

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 macOS 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 macOS X. If you jumped into this project here, without doing any of the previous steps, go back and start at step 1, Install Common Components. Continue to at least one 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), Salesforce 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

  1. To check if Cordova is already installed, at the OS command prompt type cordova -version and press Return.
    • If this command reports version 11.0.0 or later, proceed to step 5. If it reports an earlier version, continue to the next step.
    • If you get a “command not found” error message, continue to step 2.
    • If Cordova prompts you to configure telemetry, indicate whether you agree to allow this Cordova feature. Cordova telemetry is a reporting tool that collects data about your usage of Cordova. See Apache Cordova CLI Privacy Policy.
  1. Install the required version.
    1. On a Mac, type sudo npm install -g cordova
    2. On Windows, type npm install -g cordova
  1. When the installer finishes, if Cordova hasn't already prompted you about telemetry as described in step 1, type cordova telemetry off or cordova telemetry on
  2. Return to step 1 to verify your installation.

Install Salesforce CLI

  1. To check if Salesforce CLI is already installed, at the OS command prompt type sf version and press Return.
    • If you see a version report such as the following, skip to Install Forcehybrid.
    • $ sf version
      sf-cli/7.94.3-a4e7c7955b darwin-x64 node-v14.15.4
    • If you get a “command not found” error message, continue to step 2.
  1. To install Salesforce CLI:
    • On a Mac, type sudo npm install -g sf-cli and press Return. If prompted, enter your system password.
    • On Windows, type npm install -g sf-cli and press Return.
  1. Return to step 1 to verify your installation.

Install CocoaPods

CocoaPods is a third-party dependency manager required by forcehybrid, a Mobile SDK utility. You need forcehybrid and CocoaPods to earn the Develop with Mobile SDK badge. However, CocoaPods is optional for real-world Mobile SDK development.

To enable forcehybrid, install CocoaPods.

  1. To check if it is already installed, type in the Terminal window: pod --version
    • If this command reports version number 1.8 or higher, you’re done—proceed to the next installation. If the reported version is below this range, continue to step 2.
    • If you get a “command not found” error message, continue to step 2.
  1. In the Terminal window, type:
    sudo gem install cocoapods -v 1.8
    If you encounter problems with this installation, consult the documentation at cocoapods.org.
  2. When the installer finishes, return to step 1.

Now that you’ve installed CocoaPods, you’re ready to install forcehybrid.

Install Forcehybrid

  1. To install forcehybrid:
    • On a Mac, type sudo npm install -g forcehybrid and press Return. If prompted, enter your system password.
    • On Windows, type npm install -g forcehybrid and press Return.
  1. To verify your installation, type forcehybrid version and press Return. For example:
    $ forcehybrid version
    forcehybrid version 10.0.0
    Your command-line printout should reflect the Mobile SDK version—currently, forcehybrid version 10.x.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 , hybrid_remote , or hybrid_lwc 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.

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios