Run Your NativeScript Apps in the Native Emulators

Filter by IDE
Select the AppBuilder client you are currently using for development.

IDE

AppBuilder lets you launch the native device emulators provided with the native platform software development kits (SDKs). In the classic Windows desktop client and the extension for Visual Studio, you can also run your NativeScript apps in the Visual Studio Emulator for Android. In the command-line interface, you can also run your NativeScript apps in the Genymotion emulator.

Running in the native emulator provides realistic test results but when possible, run your app on a physical device.

Prerequisites

AppBuilder Prerequisites

  • Verify that your preferred AppBuilder client is running and you are logged in.
  • Verify that you have opened the code for your app in AppBuilder.

iOS Prerequisites

  • Verify that you have have access to a properly configured macOS system.
    1. Verify that you have installed the command-line interface on the macOS system.
    2. Verify that you have installed Xcode 7 or newer on the macOS system.
      The version of Xcode must be compatible with the version of the ios-sim-portable npm package on which AppBuilder relies.
      For more information, see ios-sim-portable in the NPM Registry.
    3. Verify that the Windows system on which you are running the classic Windows desktop client can reach the macOS system.

Android Prerequisites

  • Before running your app in the native Android emulator from the Android SDK, verify that your system meets the following requirements.
    • Verify that you have installed the Android SDK.
      For more information about downloading and installing the Android SDK, see Get the Android SDK.
    • If you want to run your app on an x86 virtual device, verify that you have configured virtual machine acceleration for the native emulator.
      For more information about virtual machine acceleration in the Android emulator, see Configuring Virtual Machine Acceleration.
    • Verify that you have configured an SD card for the virtual device on which you want to run your app.
      For more information about SD cards in the native emulator, see SD Card Emulation.
  • Before running your app in the Visual Studio Emulator for Android, verify that you have installed and configured the Visual Studio Emulator for Android.
    You can download it from this page or you can access it from your Microsoft Visual Studio 2015 installation.
  • Before running your app in Genymotion, verify that your system meets the following requirements.

    • Verify that you have installed Genymotion.
    • Verify that you have installed the command-line interface.
    • On Windows and Linux systems, verify that you have added the Genymotion installation directory to the PATH environment variable.
    • On macOS systems, verify that you have added the following paths to the PATH environment variable.

      • For Genymotion earlier than 2.6:
        • /Applications/Genymotion.app/Contents/MacOS/
        • /Applications/Genymotion Shell.app/Contents/MacOS/
      • For Genymotion 2.6:

        • /Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS
        • /Applications/Genymotion Shell.app/Contents/MacOS/

        For example: Run the following command export PATH=$PATH:/Applications/Genymotion\ Shell.app/Contents/MacOS/:/Applications/Genymotion.app/Contents/MacOS/

Procedure

In-Browser

This operation is not available in the in-browser client.

Windows

Run your app in the iOS Simulator

The iOS SDK for native iOS development provides the iOS Simulator, a native iOS emulator. You can run your NativeScript apps in the native iOS Simulator.

When you select to run your app in the native emulator, AppBuilder builds an application package (IPA) and loads it in the emulator on a macOS system.

In this version of the classic Windows desktop client, you cannot LiveSync changes and debug apps in the iOS Simulator.

To apply code changes to your app, you need to re-deploy your app.

  1. Verify that you have have access to a properly configured macOS system.
    1. Verify that you have installed the command-line interface on the macOS system.
    2. Verify that you have installed Xcode 7 or newer on the macOS system.
      The version of Xcode must be compatible with the version of the ios-sim-portable npm package on which AppBuilder relies.
      For more information, see ios-sim-portable in the NPM Registry.
    3. Verify that the Windows system on which you are running the classic Windows desktop client can reach the macOS system.
  2. Configure a remote server on the macOS system.

    1. (Optional) Check which ports are open on the macOS system. For more information, see OS X Mountain Lion: Check for open TCP ports.
    2. To launch the app on a default device, in the terminal, run the following command.

      appbuilder remote <Port>
      

      <Port> is the port on which the command-line interface listens for requests from the classic Windows desktop client.
      Make sure that the port is open and that your firewall allows traffic on it, if configured.
      Make sure that your Windows system can reach and send traffic to the macOS system on the specified port.

      If you want to use a port in the range of 0 through 1023, run this command using sudo. For example: sudo appbuilder remote 443

    3. To launch the app on a selected device, in the terminal, run the following commands.

      isim device-types
      appbuilder remote <Port> --device <Device Name>
      

      <Device Name> is the name of the device that you want to use as listed by isim device-types

      <Port> is the port on which the command-line interface listens for requests from the classic Windows desktop client.
      Make sure that the port is open and that your firewall allows traffic on it, if configured.
      Make sure that your Windows system can reach and send traffic to the macOS system on the specified port.

      If you want to use a port in the range of 0 through 1023, run this command using sudo. For example: sudo appbuilder remote 443

  3. In the classic Windows desktop client, select RunNative Emulator.

  4. Select iOS and click Next.
  5. In the Address text box, provide the address of the macOS system. The address must be in any of the following formats.

    http://192.168.32.22
    http://mymac
    

    You can provide the IP address or the name of the machine.

  6. In the Port text box, provide the port you have configured in Step 2.
  7. Select target device.
  8. Click Launch Emulator and wait for the build to complete.
    If you have set a device in Step 2, AppBuilder disregards your choice from Step 7 and launches your app in the device selected with the appbuilder remote command.

On the macOS system, the command-line interface launches the iOS Simulator and loads your app.

To apply code changes to your app, you need to re-deploy your app. To re-deploy your app, you need to repeat Steps 3-8.

Run your app in the Android emulator from the Android SDK

The Android software development kit (SDK) for native Android development provides a native emulator. In AppBuilder, you can run your NativeScript apps in the native Android emulator.

To test your app during development, you can build and deploy it in the native device emulator. With the Android emulator, you can create and manage a number of virtual devices with different device configurations. This way you can test your app on an array of Android devices without actually deploying the app on a physical device.

While the emulator is running, AppBuilder recognizes and treats the virtual device as a connected device. When you select to run your app in the native emulator, AppBuilder builds an application package (APK) and loads it in the emulator.

  1. (Optional) Configure how AppBuilder works with the emulator.
    1. In the title bar, click your user name and select Options.
    2. In the General tab, select EmulatorsAndroid Emulator.
    3. Configure the network speed of the emulated device.
    4. Configure the network latency of the emulated device.
    5. Manage the boot animation of the native emulator.
    6. Configure the emulator to wipe any previous user data.
    7. Set additional arguments.
      AppBuilder uses the command line from the Android SDK to launch your emulated device. You can customize the launched device with any option available for the emulator command. For more information about the options that you can set, see Android Emulator: Command Line Parameters.
    8. Click OK.
  2. In the top menu bar, select RunNative Emulator.
  3. Select Android, select Android SDK and click Next.
  4. If you do not see Next, you need to configure the native emulator.
    1. Download and install the Android SDK.
    2. If you have already installed the Android SDK and AppBuilder cannot locate the installed SDK automatically, click Browse and provide the location where the SDK is installed.
    3. Click Next.
  5. (Optional) Click AVD Manager to create new virtual devices.
  6. Select a virtual device from the list and click Launch Emulator.
  7. Wait for the emulator to load and unlock its screen, if locked.

Your app launches automatically in the emulator.

Run your app in the Visual Studio Emulator for Android

Microsoft Visual Studio 2015 provides a built-in Android emulator. In AppBuilder, you can run your NativeScript apps in the Visual Studio Emulator for Android.

To test your app during development, you can build and deploy it in a device emulator. With the Visual Studio Emulator for Android, you can create and manage a number of virtual devices with different device configurations. This way you can test your app on an array of Android devices without actually deploying the app on a physical device.

While the emulator is running, AppBuilder recognizes and treats the virtual device as a connected device. When you select to run your app in the native emulator, AppBuilder builds an application package (APK) and loads it in the emulator.

  1. (Optional) Configure how AppBuilder works with the emulator.
    1. In the title bar, click your user name and select Options.
    2. In the General tab, select EmulatorsAndroid Emulator.
    3. Configure the network speed of the emulated device.
    4. Configure the network latency of the emulated device.
    5. Manage the boot animation of the native emulator.
    6. Configure the emulator to wipe any previous user data.
    7. Set additional arguments.
      AppBuilder uses the command line from the Android SDK to launch your emulated device. You can customize the launched device with any option available for the emulator command. For more information about the options that you can set, see Android Emulator: Command Line Parameters.
    8. Click OK.
  2. In the top menu bar, select RunNative Emulator.
  3. Select Android, select Visual Studio and click Next.
  4. If you do not see Next, you need to configure the native emulator.
    1. Download and install the Android SDK.
    2. If you have already installed the Android SDK and AppBuilder cannot locate the installed SDK automatically, click Browse and provide the location where the SDK is installed.
    3. Click Next.
  5. (Optional) Click Emulator Manager to create new virtual devices.
  6. Select a virtual device from the list and click Launch Emulator.
  7. Wait for the emulator to load and unlock its screen, if locked.

Your app launches automatically in the emulator.

Visual Studio

Run your app in the iOS Simulator

The iOS SDK for native iOS development provides the iOS Simulator, a native iOS emulator. You can run your NativeScript apps in the native iOS Simulator.

When you select to run your app in the native emulator, AppBuilder builds an application package (IPA) and loads it in the emulator on a macOS system.

In this version of the extension for Visual Studio, you cannot LiveSync changes and debug apps in the iOS Simulator.

To apply code changes to your app, you need to re-deploy your app.

  1. Verify that you have have access to a properly configured macOS system.
    1. Verify that you have installed the command-line interface on the macOS system.
    2. Verify that you have installed Xcode 7 or newer on the macOS system.
      The version of Xcode must be compatible with the version of the ios-sim-portable npm package on which AppBuilder relies.
      For more information, see ios-sim-portable in the NPM Registry.
    3. Verify that the Windows system on which you are running the extension for Visual Studio can reach the macOS system.
  2. Configure a remote server on the macOS system.

    1. (Optional) Check which ports are open on the macOS system. For more information, see OS X Mountain Lion: Check for open TCP ports.
    2. To launch the app on a default device, in the terminal, run the following command.

      appbuilder remote <Port>
      

      <Port> is the port on which the command-line interface listens for requests from the extension for Visual Studio.
      Make sure that the port is open and that your firewall allows traffic on it, if configured.
      Make sure that your Windows system can reach and send traffic to the macOS system on the specified port.

      If you want to use a port in the range of 0 through 1023, run this command using sudo. For example: sudo appbuilder remote 443

    3. To launch the app on a selected device, in the terminal, run the following commands.

      isim device-types
      appbuilder remote <Port> --device <Device Name>
      

      <Device Name> is the name of the device that you want to use as listed by isim device-types

      <Port> is the port on which the command-line interface listens for requests from the extension for Visual Studio.
      Make sure that the port is open and that your firewall allows traffic on it, if configured.
      Make sure that your Windows system can reach and send traffic to the macOS system on the specified port.

      If you want to use a port in the range of 0 through 1023, run this command using sudo. For example: sudo appbuilder remote 443

  3. In the extension for Visual Studio, select AppBuilderRun Native Emulator.

  4. Select iOS and click Next.
  5. In the Address text box, provide the address of the macOS system. The address must be in any of the following formats.

    http://192.168.32.22
    http://mymac
    

    You can provide the IP address or the name of the machine.

  6. In the Port text box, provide the port you have configured in Step 2.
  7. Select target device.
  8. Click Launch Emulator and wait for the build to complete.
    If you have set a device in Step 2, AppBuilder disregards your choice from Step 7 and launches your app in the device selected with the appbuilder remote command.

On the macOS system, the command-line interface launches the iOS Simulator and loads your app.

To apply code changes to your app, you need to re-deploy your app. To re-deploy your app, you need to repeat Steps 3-8.

Run your app in the Android emulator from the Android SDK

The Android software development kit (SDK) for native Android development provides a native emulator. In AppBuilder, you can run your NativeScript apps in the native Android emulator.

To test your app during development, you can build and deploy it in the native device emulator. With the Android emulator, you can create and manage a number of virtual devices with different device configurations. This way you can test your app on an array of Android devices without actually deploying the app on a physical device.

While the emulator is running, AppBuilder recognizes and treats the virtual device as a connected device. When you select to run your app in the native emulator, AppBuilder builds an application package (APK) and loads it in the emulator.

  1. (Optional) Configure how AppBuilder works with the emulator.
    1. In the top menu bar, select AppBuilderOptions.
    2. In the General tab, select EmulatorsAndroid Emulator.
    3. Configure the network speed of the emulated device.
    4. Configure the network latency of the emulated device.
    5. Manage the boot animation of the native emulator.
    6. Configure the emulator to wipe any previous user data.
    7. Set additional arguments.
      AppBuilder uses the command line from the Android SDK to launch your emulated device. You can customize the launched device with any option available for the emulator command. For more information about the options that you can set, see Android Emulator: Command Line Parameters.
    8. Click OK.
  2. In the top menu bar, select AppBuilderRun Native Emulator.
  3. Select Android
  4. Select Android SDK.
  5. Select build configuration.

    Option Description
    Debug
    • Includes any *.debug.* files in your application package, removes the debug modifiers from the file names and renames them to *.*.
    • If applicable to the AppBuilder client, applies any additional exclude or include rules defined in .debug.abignore.
    Release
    • Includes any *.release.* files in your application package, removes the release modifiers from the file names and renames them to *.*.
    • If applicable to the AppBuilder client, applies any additional exclude or include rules defined in .debug.abignore.

    Android CPU architectures are detected by AppBuilder and selected automatically when running apps on Native Emulators.

  6. Click Next.
  7. If you do not see Next, you need to configure the native emulator.
    1. Download and install the Android SDK.
    2. If you have already installed the Android SDK and AppBuilder cannot locate the installed SDK automatically, click Browse and provide the location where the SDK is installed.
    3. Click Next.
  8. (Optional) Click AVD Manager to create new virtual devices.
  9. Select a virtual device from the list and click Launch Emulator.
  10. Wait for the emulator to load and unlock its screen, if locked.

Your app launches automatically in the emulator.

Run your app in the Visual Studio Emulator for Android

Microsoft Visual Studio 2015 provides a built-in Android emulator. In AppBuilder, you can run your NativeScript apps in the Visual Studio Emulator for Android.

To test your app during development, you can build and deploy it in a device emulator. With the Visual Studio Emulator for Android, you can create and manage a number of virtual devices with different device configurations. This way you can test your app on an array of Android devices without actually deploying the app on a physical device.

While the emulator is running, AppBuilder recognizes and treats the virtual device as a connected device. When you select to run your app in the native emulator, AppBuilder builds an application package (APK) and loads it in the emulator.

  1. (Optional) Configure how AppBuilder works with the emulator.
    1. In the top menu bar, select AppBuilderOptions.
    2. In the General tab, select EmulatorsAndroid Emulator.
    3. Configure the network speed of the emulated device.
    4. Configure the network latency of the emulated device.
    5. Manage the boot animation of the native emulator.
    6. Configure the emulator to wipe any previous user data.
    7. Set additional arguments.
      AppBuilder uses the command line from the Android SDK to launch your emulated device. You can customize the launched device with any option available for the emulator command. For more information about the options that you can set, see Android Emulator: Command Line Parameters.
    8. Click OK.
  2. In the top menu bar, select AppBuilderRun Native Emulator.
  3. Select Android
  4. Select Android SDK.
  5. Select build configuration.

    Option Description
    Debug
    • Includes any *.debug.* files in your application package, removes the debug modifiers from the file names and renames them to *.*.
    • If applicable to the AppBuilder client, applies any additional exclude or include rules defined in .debug.abignore.
    Release
    • Includes any *.release.* files in your application package, removes the release modifiers from the file names and renames them to *.*.
    • If applicable to the AppBuilder client, applies any additional exclude or include rules defined in .debug.abignore.

    Android CPU architectures are detected by AppBuilder and selected automatically when running apps on Native Emulators.

  6. Click Next.
  7. If you do not see Next, you need to configure the native emulator.
    1. Download and install the Android SDK.
    2. If you have already installed the Android SDK and AppBuilder cannot locate the installed SDK automatically, click Browse and provide the location where the SDK is installed.
    3. Click Next.
  8. (Optional) Click Emulator Manager to create new virtual devices.
  9. Select a virtual device from the list and click Launch Emulator.
  10. Wait for the emulator to load and unlock its screen, if locked.

Your app launches automatically in the emulator.

CLI

Run your app in the iOS Simulator

The iOS SDK for native iOS development provides the iOS Simulator, a native iOS emulator. You can run your NativeScript apps in the native iOS Simulator.

When you select to run your app in the native emulator, AppBuilder builds an application package (IPA) and loads it in the emulator on a macOS system.

The command-line interface recognizes the iOS Simulator as a connected device.

This operation is available only on macOS systems.

  1. Verify that you have installed Xcode 7 or newer on the macOS system.
    The version of Xcode must be compatible with the version of the ios-sim-portable npm package on which AppBuilder relies.
    For more information, see ios-sim-portable in the NPM Registry.
  2. To launch your app on the default device, run the following command.

    appbuilder emulate ios
    
  3. To launch your app on a selected device, run the following commands.

    appbuilder emulate ios --available-devices
    appbuilder emulate ios --device <Device Name>
    

    <Device Name> is the name of the device that you want to use as listed by appbuilder emulate ios --available-devices

  4. Wait for the iOS Simulator to load.

Your app launches automatically in the emulator.

Run your app in the Android emulator

The Android software development kit (SDK) for native Android development provides a native emulator. In AppBuilder, you can run your NativeScript apps in the native Android emulator.

To test your app during development, you can build and deploy it in the native device emulator. With the Android emulator, you can create and manage a number of virtual devices with different device configurations. This way you can test your app on an array of Android devices without actually deploying the app on a physical device.

While the emulator is running, AppBuilder recognizes and treats the virtual device as a connected device. When you select to run your app in the native emulator, AppBuilder builds an application package (APK) and loads it in the emulator.

  1. To run your app in the Android emulator from the Android SDK, run the following command.

    appbuilder emulate android --avd <Name>
    

    Where <Name> is the name of the Android virtual device, as listed by android list avd. You can specify only one virtual device at a time.
    If you do not set the --avd option, the command-line interface launches the default virtual device or runs your app in a currently running virtual device, if any.

    The command-line interface launches the selected virtual device, if not running. If the selected virtual device is already running, the command-line interface deploys your app in it.

  2. To run your app in Genymotion, run the following command.

    appbuilder emulate android --geny <Name>
    

    Where <Name> is the name of the Genymotion virtual device, as listed by genyshell -c "devices list". You can specify only one virtual device at a time.
    If you do not set the --geny option, the command-line interface launches the default Android virtual device or runs your app in a currently running virtual device, if any.

    The command-line interface launches the selected virtual device, if not running. If the selected virtual device is already running, the command-line interface deploys your app in it.

  3. Wait for the emulator to load.
  4. (Optional) Repeat Steps 1-3 for any additional Android virtual devices on which you want to run your app.

Next Steps

Examine the NativeScript API documentation and continue with your native development.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.