Running and Debugging Applications

You can run your application on the emulator or the target device. You can also run mobile applications on the simulator. Use the Rapid Development Support feature to speed up the development tasks. If your application does not run without problems, you can debug it.

Running Web Applications on the Emulator

You can debug Tizen Web applications on the emulator using the Project Explorer view or the Tizen Studio menu.

To launch the emulator, do one of the following:

  • Use the Emulator Manager:

    1. Start the Emulator Manager using the Desktop (in Ubuntu) or Start menu (in Windows®), or using the command line.

    2. In the Emulator Manager window, select the emulator instance from the list.

      If you are using the Emulator Manager for the first time, you must create an emulator instance: click Create, select the platform (system image) and template (device definition), and click Finish.

    3. Click Launch.

  • Use the command line.

To run the application on the emulator, do one of the following:

  • In the Project Explorer view, right-click the project and select Run As > Tizen Web Application.
  • In the Tizen Studio menu, go to Run > Run As > Tizen Web Application.
  • On the Tizen Studio toolbar, click Run.

To stop the emulator, right-click the emulator and click Close.

Note
Running an emulator instance requires a minimum free disk space of 20 MB. The emulator image can occupy up to 10 GB of disk space.

Running Web Applications on a Target Device

You can run Tizen Web applications on a target device using the Project Explorer view or the Tizen Studio menu.

To run your application on the target device:

  1. Connect the target device to your computer.

  2. Open the Run Configurations window by doing one of the following:

    • In the Project Explorer view, right-click the project andselect Run As > Run Configurations.
    • In the Tizen Studio menu, go to Run > Run Configurations.
  3. In the Run Configurations window, click New Launch Configuration.

    If you have not made any changes to the application source files since the last time the application was run, Rapid Development Support (RDS) is used to skip the package upload and make running the application faster. RDS is enabled as default. To disable it, go to Window > Preferences > Tizen Studio > Rapid Development Support.

  4. Set the timeout using the Timeout value slider.

    The timeout value represents the waiting time for the application launch operation. If you are using a lower configuration computer, set a higher timeout value to avoid application launch failure errors.

  5. Start the run by clicking Run.

    If no changes are required in the run configuration, you can also run the application on the target device by doing one of the following:

    • In the Project Explorer view, right-click the project and select Run As > Tizen Web Application.
    • In the Tizen Studio menu, go to Run > Run As > Tizen Web Application.
    • On the Tizen Studio toolbar, click Run.

If the Web application successfully launches on the target device, the JavaScript Log Console View is automatically launched in Tizen Studio. The JavaScript Log Console view displays Web application JavaScript logs.

Running Mobile Web Applications on the Simulator

You can run Tizen Web applications on the Web Simulator using the Project Explorer view or the Tizen Studio menu.

Note
The Tizen Web Simulator runs only on the Google Chrome™ browser. To use the Web Simulator, download and install the Google Chrome™ browser. You can manually specify the installation location of the browser in the simulator preferences.

If you are running your Web application on the Web Simulator for the first time, create a running configuration by selecting Run > Run Configurations > Tizen Web Simulator Application in the Tizen Studio menu. The running configuration contains the application launch settings.

To run your application on the Simulator, do one of the following:

  • In the Project Explorer view, right-click the project and select Run As > Tizen Web Simulator Application.
  • In the Tizen Studio menu, go to Run > Run As > Tizen Web Simulator Application.
  • On the Tizen Studio toolbar, click Run.

When the application is launched, the Web Simulator loads the file specified in the Content field of the config.xml file. The mostly commonly specified file is index.html.

The simulator renders your application on the browser using the WebKit engine. All the Google Chrome™ browser development features are available (by pressing the F12 keyboard key) in the simulator, as is the Web Inspector tool. You can leverage the advantages of the Web Simulator tool by setting the device screen size and orientation, and by sending events and messages, such as geolocation data and sensor input events, to your application for debugging it.

Debugging Web Applications

Debugging a Web application enables you to understand its flow of control. You can debug a Web application by running it on the target device and debugging its JavaScript code. JavaScript code debugging uses the Web Inspector tool.

To debug your application on the target device:

  1. Connect the target device to your computer.

  2. Open the Debug Configurations window by doing one of the following:

    • In the Project Explorer view, right-click the project and select Debug As > Debug Configurations.
    • In the Tizen Studio menu, go to Run > Debug Configurations.
  3. In the Debug Configurations window, click New Launch Configuration.

    If you have not made any changes to the application source files since the last time the application was run, Rapid Development Support (RDS) is used to skip the package upload and make running the application faster. RDS is enabled as default. To disable it, go to Window > Preferences > Tizen Studio > Rapid Development Support.

  4. Set the timeout using the Timeout value slider.

    The timeout value represents the waiting time for the application launch operation. If you are using a lower configuration system, set a higher timeout value to avoid application launch failure errors.

  5. Start the debugging by clicking Debug.

    If no changes are required in the debug configuration, you can also debug the application on the target device by doing one of the following:

    • In the Project Explorer view, right-click the project and select Debug As > Tizen Web Application.
    • In the Tizen Studio menu, go to Run > Debug As > Tizen Web Application.
    • On the Tizen Studio toolbar, click Debug.

    The Web Inspector tool is displayed in a new Google Chrome™ browser window. You can perform the following debugging tasks using the Web Inspector:

    • Inspect styles
    • Inspect the DOM
    • Inspect resources
    • Debug JavaScript code

    Note
    The Web Inspector always opens in a new window. Life-cycle synchronization between the application to be debugged and the Web Inspector browser is not supported.

    Installing the Google Chrome™ browser on the device is mandatory for the Web Inspector to work. When the Google Chrome™ browser is installed on the device, Tizen Studio automatically detects it. To select the browser path, go to Window > Preferences > Tizen Studio > Web > Chrome.

  6. To debug the JavaScript code, click Sources in the Web Inspector menu.

    You must enable debugging before debugging JavaScript code.

  7. You can also set a break point in the code by right-clicking in the marker bar area on the left side of the editor, and selecting Toggle Breakpoint.

    Once the break points are set, you can watch variables, expressions, and the current call stack. You can also control the debugging by using the following control buttons.

    Table: Control buttons for debugging between break points

    Button Description
    Resume Resumes the current execution.
    Step over Steps over the highlighted statement.
    Executes the current line, and if the line contains a method, executes the method without entering it.
    Step in Steps into the highlighted statement.
    Executes the current line, and if the line contains a method, steps into the method.
    Step out Steps out of the current method.
    Deactivate all break  points Deactivates all break points.

If the Web application successfully launches on the target device, the JavaScript Log Console View is automatically launched in Tizen Studio. The JavaScript Log Console view displays Web application JavaScript logs.

Rapid Development Support

Rapid Development Support (RDS) lets you develop a Tizen application rapidly by saving deployment time.

When using RDS, the application is first launched normally. After the launch, a listener is activated to detect file modifications, additions, and deletions. Any detected file changes are sent to the target as a background process. When the application is launched again, the original packaging, transfer, and installation process is skipped, and only the changed files are reinstalled and executed.

If an error occurs during execution, the application is launched in the normal mode instead.

To launch the application in normal mode:

  1. Package the application.
  2. Transfer the packaged file to the target.
  3. Install the packaged file in the target. If the application is already installed, uninstall it before the installation.

To launch the application in RDS mode:

  1. Search for the changed files (modified, added, and deleted) and transfer them to the target as a background process.
  2. Reinstall the changed files.
  3. If the config.xml file has been modified, execute directory installation.

The RDS option is enabled as default. To disable it, in Tizen Studio, go to Window > Preferences > Tizen Studio > Rapid Development Support.

Note
RDS is not supported in multi-app projects.

If you want to remove an application from your device, you must manually delete the installed application as the launch process does not have an uninstall process.