Install cross-platform Mobile development with C++

You can use C++ in Visual Studio to build Windows Desktop apps, Universal Windows Platform (UWP) apps, Linux apps, and now, apps for Android and iOS. The Mobile development with C++ workload is an installable set of components in Visual Studio that includes cross-platform iOS, Android, and UWP Visual Studio templates. It installs the cross-platform tools and SDKs you need to get started quickly, without having to locate, download, and configure them yourself. You can use these tools in Visual Studio to easily create, edit, debug, and test your cross-platform projects. This topic describes how to install the tools and third-party software required to develop cross-platform apps in C++ using Visual Studio. For an overview, see Visual C++ cross-platform mobile

Requirements

  • For installation requirements, see Visual Studio product family system requirements.

    Important

    If you are using Windows 7 or Windows Server 2008 R2, you can develop code for Windows Desktop applications, Android Native Activity apps and libraries, and apps and code libraries for iOS, but not Windows Phone or UWP apps.

To build apps for specific device platforms, there are some additional requirements:

  • Windows Phone emulators and the Microsoft Visual Studio Emulator for Android require a computer that can run Hyper-V. The Hyper-V feature in Windows must be enabled before you can install and run the emulators. For more information, see the emulator's system requirements.

  • The x86 Android emulators that come with the Android SDK work best on computers that can run the Intel HAXM driver. This driver requires an Intel x64 processor with VT-x and Execute Disable Bit support. For more information, see Intel® Hardware Accelerated Execution Manager (Intel® HAXM).

  • Building code for iOS requires an Apple ID, an iOS Developer Program account, and a Mac computer that can run Xcode version 6 or later on OS X Mavericks (version 10.9) or later versions. For a link to installation steps, see Install tools for iOS.

Get the tools

Mobile development with C++ is available in Visual Studio Community, Professional, and Enterprise editions. To get Visual Studio, go to the Visual Studio downloads page. The cross-platform mobile development tools are available starting in Visual Studio 2015 Update 2 or later.

Install the tools

The Visual Studio Installer for Visual Studio 2017 includes a Mobile development with C++ workload that installs the C++ language tools, templates, and components required for Android and iOS development in Visual Studio. It installs the GCC and Clang toolsets needed for Android builds and debugging, and components to communicate with a Mac for iOS development. It also installs all the third-party tools and software development kits that are required to support iOS and Android app development. Most of these third-party tools are open-source software required for Android platform support.

  • Android Native Development Kit (NDK) is required to build C++ code that targets the Android platform.

  • Android SDK, Apache Ant, and Java SE Development Kit are required for the Android build process.

  • The Google Android Emulator and Intel Hardware Accelerated Execution Manager are optional, but recommended, components. You can develop and debug directly on an Android device, but it's often easier to use an emulator on your desktop for debugging. Microsoft also provides a Visual Studio Emulator for Android that can be installed separately.

To install the Mobile development with C++ workload in Visual Studio 2017

  1. Run the Visual Studio Installer from the Start menu.

  2. If you've already installed Visual Studio, choose the Modify button for the installed version of Visual Studio you'd like to modify. Otherwise, choose Install to install Visual Studio.

  3. With the Workloads tab selected, scroll down and select the Mobile development with C++ workload in the Visual Studio Installer. When this workload is selected, other required components for C++ development are also selected. You can also choose other workloads and individual components to install at the same time. To build cross-platform code that also targets UWP, select the Universal Windows Platform development workload.

  4. In the Installation details pane, expand Mobile development with C++. In the Optional section, you can choose additional versions of the NDK, the Google Android Emulator, the Intel Hardware Accelerated Execution Manager, and the IncrediBuild build acceleration tool.

  5. By default, one or more Android SDK setup components are included by the workload. Additional versions of the Android SDK are available. To add one to your installation, choose the Individual components tab, then scroll down to the SDKs, libraries, and frameworks section to make your selection.

  6. Choose the Modify or Install button to install the Mobile development with C++ workload and your other selected workloads and optional components.

    When installation is complete, close the installer and then restart your computer. Some setup actions for the third-party components do not take effect until the computer is restarted.

    Important

    You must restart to make sure everything is installed correctly.

  7. Open Visual Studio. If this is the first time that you have run Visual Studio, it may take some time to configure and sign in. When Visual Studio is ready, check for any updates and install them.

To install the Mobile Development component and third-party tools in Visual Studio 2015

If you are using Visual Studio 2015, its installer includes an option to install Visual C++ for Cross-Platform Mobile Development, which installs the required C++ language tools, templates, and components in Visual Studio 2015.

  1. Run the Visual Studio 2015 installer. To install optional components, choose Custom as the type of installation. Choose Next to select the optional components to install.

  2. In Select features, expand Cross Platform Mobile Development and check Visual C++ Mobile Development.

    Select Visual C++ Mobile Development

    By default, when you select Visual C++ Mobile Development, the Programming Languages option is set to install Visual C++, and the Common Tools and Software Development Kits options are set to install required third-party components. You can choose additional components if you need them. By default, the Microsoft Visual Studio Emulator for Android is also selected. Components that are already installed appear inactive in the list.

    To build Universal Windows apps and share code between them and your Android and iOS projects, in Select features, expand Windows and Web Development and check Universal Windows App Development Tools. If you don't plan to build Universal Windows apps, you can skip this option.

    Choose Next to continue.

  3. The third-party components have their own license terms. You can view the license terms by choosing the License Terms link next to each component. Choose Install to add the components and install Visual Studio and Visual C++ for Cross-Platform Mobile Development.

  4. When installation is complete, close the installer and then restart your computer. Some setup actions for the third-party components do not take effect until the computer is restarted.

    Important

    You must restart to make sure everything is installed correctly.

    If the Microsoft Visual Studio Emulator for Android component failed to install, your computer may not have Hyper-V enabled. Use the Turn Windows features on or off Control Panel app to enable Hyper-V, and then run the Visual Studio installer again.

    Note

    If your computer or your version of Windows does not support Hyper-V, you can't use the Microsoft Visual Studio Emulator for Android component. The Home Edition of Windows does not include Hyper-V support.

  5. Open Visual Studio. If this is the first time that you have run Visual Studio, it may take some time to configure and sign in. When Visual Studio is ready, on the Tools menu, select Extensions and Updates, Updates. If there are Visual Studio updates available for Visual C++ for Cross-Platform Mobile Development or for Microsoft Visual Studio Emulator for Android, install them.

Install tools for iOS

You can use Visual C++ for Cross-Platform Mobile Development to edit, debug, and deploy iOS code to the iOS Simulator or to an iOS device, but because of licensing restrictions, the code must be built remotely on a Mac. To build and run iOS apps using Visual Studio, you must set up and configure the remote agent on your Mac. For detailed installation instructions, prerequisites and configuration options, see Install and configure tools to build using iOS. If you're not building for iOS, you can skip this step.

Install or update dependencies manually

If you decide not to install one or more third-party dependencies using the Visual Studio installer when you install the Mobile development with C++ workload (or in Visual Studio 2015, the Visual C++ Mobile Development option), you can install them later by using the steps in Install the tools. The Visual Studio Installer is updated regularly to install the latest third-party components. You can use it to install updated SDKs and NDKs. You can also install or update them independently of Visual Studio.

Caution

You can install the dependencies in any order, except for Java. You must install and configure the JDK before you install the Android SDK.

Read the following information and use these links to install dependencies manually.

  • Java SE Development Kit

    By default, the installer puts the Java tools in C:\Program Files (x86)\Java.

  • Android SDK

    During the installation, update the APIs as recommended. Make sure that at least the SDK for Android 5.0 Lollipop (API level 21) is installed. By default, the installer puts the Android SDK in C:\Program Files (x86)\Android\android-sdk.

    You can run the SDK Manager app in the Android SDK directory again to update the SDK and install optional tools and additional API levels. Updates may fail to install unless you use Run as administrator to run the SDK Manager app. If you have problems building an Android app, check the SDK Manager for updates to your installed SDKs.

    To use some of the Android emulators that come with the Android SDK, you must install the optional Intel HAXM drivers. You may have to remove the Hyper-V feature from Windows to install the Intel HAXM drivers successfully. You must restore the Hyper-V feature to use the Windows Phone emulators and the Microsoft Visual Studio Emulator for Android. For more information, see Android Emulator hardware acceleration.

  • Android NDK

    By default, the installer puts the Android NDK in C:\ProgramData\Microsoft\AndroidNDK. You can download and install the Android NDK again to update the NDK installation.

  • Apache Ant

    By default, the installer puts Apache Ant in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps.

  • Microsoft Visual Studio Emulator for Android

    Microsoft Visual Studio Emulator for Android is an optional emulator useful for testing and debugging your code. After the release of Visual Studio Emulator for Android, Google updated their Android emulator to use hardware acceleration through Intel’s HAXM. We recommend you use Google’s accelerated emulator when you can, as it offers access to the latest Android OS images and Google Play services.

In most cases, Visual Studio can detect the configurations for the third-party software you've installed, and maintains the installation paths in internal environment variables. You can override the default paths of these cross-platform development tools in the Visual Studio IDE.

To set the paths for third-party tools

  1. On the Visual Studio menu bar, select Tools > Options.

  2. In the Options dialog box, select Cross Platform > C++ > Android.

    Android tool path options

  3. To change the path used by a tool, check the checkbox next to the path, and edit the folder path in the textbox. You can also use the browse button (...) to open a Select location dialog to choose the folder.

  4. Choose OK to save the custom tool folder locations.

See also