Build and test your app

Here's where you can find information about building, configuring, testing, and deploying your app using the Momentics IDE for BlackBerry.

The Momentics IDE is the key development tool for all BlackBerry 10 native applications (both core C/C++ applications and Cascades applications). The Momentics IDE has a set of Eclipse views that are designed to help speed up the development process for Cascades applications. You can access these views by using the QML Editing Perspective in the IDE.

Before you try to build and run your app, make sure that you've set up your environment.

For more information, see Using the Momentics IDE.

Build configurations

After you create a project, you need to build it before you can run it on a device or simulator. The build configuration type determines how the binary file is packaged (with or without debugging capability), and what type of target it runs on (device or simulator). Executables built using a debug configuration contain additional debug information that lets the debugger make direct associations between the source code and the binaries generated from that original source.

In addition, each build configuration can also contain a unique set of assets (as specified on the Assets page in the bar-descriptor.xml file).

When building your application, there are several different build configurations to choose from. To get started, you can use one of the following:

  • Device-Debug (the default build configuration)
  • Device-Profile
  • Device-Release
  • Simulator-Debug

To change the build configuration, right-click the project and select Build Configurations > Set Active and select the new build configuration.

When you build your project, the IDE creates binaries that are configured to run on the target that you specified. To build the binaries, right-click the project and click Build Project or click the build button Momentics build button.

Launch configurations

To run, debug, or profile an application on your target device or simulator, you need a launch configuration. If you don't create a run configuration, the Momentics IDE creates a default configuration for you when you run your application for the first time. You can select Run, Debug, Profile, or Run Release from the Active Tool drop-down list and use the default launch configuration for each of these tools.

If you want more control, you can create a launch configuration. A launch configuration consists of various settings and environment variables that affect how the application starts. You enter these settings once, and then you can use this collection of settings again and again.

To create a launch configuration:

  1. Right-click a project in the Project Explorer view and select Run As > BlackBerry C/C++ Application Dialog to create a run configuration (or Debug As > BlackBerry C/C++ Application Dialog to create a debug configuration).
  2. Click the New launch configuration icon.
  3. In the Main tab, in the Build configuration drop-down list, choose a build configuration for your application.
  4. Make sure that your target is listed under Target Options, and then click Apply. The launch configuration is now ready.
  5. Click Close.

If a target is not listed under Target Options, you might not have set up a target correctly. To set up a target, run the BlackBerry Deployment Setup Wizard.

For more details about launch configurations, see Create and run a launch configuration.

Debugging your app

One of the most frequently used tools in the traditional design-develop-debug cycle is the source-level debugger. The Momentics IDE for BlackBerry provides a source-level debugger that's integrated with the other workbench tools, giving you the flexibility you need to address the problems that you encounter when developing your apps.

To take advantage of the debugging capabilities of the IDE, you must use application executables compiled for debugging. These executables contain additional debug information that lets the debugger make direct associations between the source code and the binaries generated from that original source. In the IDE, you see different icons: an arrowhead icon for executables that weren't compiled for debugging, or a bug for executables that were compiled for debugging.

The IDE updates the views in the Debug perspective only when the application is suspended (for example, when the debugger hits a breakpoint, or when you're stepping through the code line by line).

To start the debugger:
  1. Make sure that your project is showing in the Active Project window or select it from the drop-down list.
  2. From the Action drop-down list, select Debug. Notice that the Action button changes.

    Screen showing the debugging toolbar in the Momentics IDE.

  3. Click Debug button.

You can also right-click the project and select Debug As > BlackBerry C/C++ Application.

The IDE switches to the Debug perspective and transfers your application from your computer across the network to your simulator or device, and starts it under the control of the debugger. The debugger stops on the first line of your application. In the Debug view, you can see an overview of your process, including the call stack. Using the buttons in the main bar of the Debug view, you can control the debugger. In an application that contains both C++ and QML, the debugger is able to move back and forth between the two.

For more information on debugging, see Use the debugger.

Profiling your app

The Momentics IDE contains tools to analyze the performance of your app. To use these tools in the IDE, you can set up a launch configuration to define which tools to run with your app (for example, the Application Profiler, the Code Coverage tool, and the Memory Analysis tool). For more information about the tools, see Using the Momentics IDE.

The Application Profiler lets you examine the overall performance of applications, no matter how large or complex, without following the source code one line at a time.

While a debugger helps you find errors in your code, profilers help you pinpoint areas of your code that could run more efficiently. When you configure your project to capture performance information, profiling can provide you with decision-making capabilities to help discover functions that consume the most CPU time.

To profile your code, you need to change the existing configuration options so that you can build your project with profiling enabled. When your launch configuration is set up for profiling, the IDE inserts code before each function to gather call information (Call Count instrumentation), or just after the function enters and just before the function exits (Function instrumentation).

To profile a C/C++ project:
  1. Make sure that your project is showing in the Active Project window or select it from the drop-down list.
  2. From the Action drop-down list, select Profile C/C++. Notice that the Action button changes.

    Screen showing the Profile C/C++ toolbar in the Momentics IDE.

  3. Click Profile button.

For more information on configuring your C/C++ project for profiling and the different methods of profiling, see Use the Application Profiler.

Running your app

When you've built the application binaries and created the launch configuration, your app is ready to run on a specified target.

To run your app:

  1. Make sure that your project is showing in the Active Project window or select it from the drop-down list.
  2. From the Action drop-down list, select Run. Notice that the Action button changes.

    Screen showing the run toolbar in the Momentics IDE.

  3. Click Run button.

Check out the Console messages. Lots of information about the settings that are active in your environment is displayed here.

Celebrate! You've successfully built your first BlackBerry app!

Last modified: 2014-01-23

comments powered by Disqus