Building and signing your completed app

When your development and testing are complete, you can build your completed app in release mode. When you build your app in release mode, the SDK packages your app resources and plugins together in a .bar file, then signs the app.

You can install the resulting signed .bar file on the BlackBerry 10 Device Simulator or on a BlackBerry 10 device, without restrictions. You can also submit it to BlackBerry World where it is reviewed, and if approved, made available to users.

Although you can build your app in release mode at any time, even if you just intend to test it, be aware that with each release build, you must increase the version number of your app. If you are still in the development and testing phase and your app is not yet complete, you should build the app in debug mode instead. For more information about building your app in debug mode, see Building your app for testing.

Before you begin:

Build your project using the SDK web tool

To build your app in release mode:

  1. Open BlackBerry WebWorks <version>. A new browser window opens, displaying the BlackBerry 10 WebWorks SDK web tool.
  2. Navigate to your project and click Build.
  3. Select Release Mode.
  4. Click Build.

When the tool has finished building and signing your app, it places the signed copy of the .bar file in the following location: <your_app_project_directory>\platforms\blackberry10\build\device.

Build your project from the command line

To build your app in release mode, you include the --release switch in your build command.

  1. On the command line, navigate to your project folder.
  2. Run the following command:
    webworks build  --release  [-k|--keystorepass <keystore_pw>] 
              [-b|--buildId <number>] [-d|--web-inspector ] 
              [-p|--params <JSON-file>] 

    Once the tool has finished running the command, it places a signed copy of the .bar file in the following location: <your_app_project_directory>\platforms\blackberry10\build\device.

For example, the following command builds version 0.3 of the app, then packages it in a .bar file, and signs it using the keystore password provided:
webworks build --release --keystorepass mypass --buildId 0.3

Check the table below for parameter details:

Parameters Description
--release

Indicates that the app is built in release mode.

-k, --keystorepass <keystore_pw>

The keystore password, which is used to sign your app. You define this password when you configure your computer to sign applications.

This parameter is required.

-b, --buildId <version_num>

The build version number of your application. Typically, this number should be incremented from the previous signed version.

This argument is optional.

-d, --web-inspector

When included, indicates that Web Inspector is enabled in the packaged app.

This argument is optional.

-p, --params <JSON-file>

A JSON file containing additional parameters to pass to downstream tools, such as blackberry-signer.

If you use the BlackBerry 10 WebWorks SDK behind a firewall, you might have to specify the proxy settings so that you are able to successfully sign your app. You can include a params.json file, which is stored in. You specify the proxy parameters in JSON format, as in the following example:

{
    "blackberry-signer": {
        "-proxyhost": "host",
        "-proxyport": "port",
        "-proxyusername": "user name",
        "-proxypassword": "password"
    }
}

When you execute the build command and include the --params params.json, the proxy settings specified in the file are passed to the blackberry-signer command, enabling the command to communicate with the BlackBerry Signing Authority to sign your app.

Deploy your signed project from the command line

You can build and deploy your app to a BlackBerry 10 device using the run command and specifying the --release parameter. The target device must be connected to your computer by USB connection or be connected to the same Wi-Fi network as your computer.

When you run this command with the --release parameter, the command builds your app, packages the app and its resources into a .bar file, then signs it. It then installs the signed .bar file onto the device, and automatically opens the app. If a .bar file with the same name exists on the device, the run command first uninstalls the existing .bar file before deploying the new .bar file. If you choose, you can skip the build or launch steps of the process.

To build and sign your app and open it on a device:

  1. On the command line, navigate to your project folder.
  2. Run the following command:
    webworks run --release  [-k|--keystorepass <keystore_pw>] 
              [-b|--buildId <number>] [-d|--web-inspector ] 
              [-p|--params <JSON-file>] 

    If successful, the run command installs and opens the app on the device. It also places a copy of the signed .bar file in the following location: <your_app_project_directory>\platforms\blackberry10\build\device.

For example, the following sample builds version 0.3 of the app, then packages it in a .bar file, signs it using the keystore password provided, and installs and opens the app on the default target device. If the app exists on the default target, the command uninstalls the previous version before installing the new version.
webworks run --release --keystorepass mypass --buildId 0.3

Check the table below for parameter details:

Parameters Description
--release

Indicates that the app is built in release mode.

-k, --keystorepass <keystore_pw>

The keystore password, which is used to sign your app. You define this password when you configure your computer to sign applications.

This parameter is required.

-b, --buildId <version_num>

The build version number of your application. Typically, this number should be incremented from the previous signed version.

This argument is optional.

-d, --web-inspector

When included, enables Web Inspector in the packaged app.

This argument is optional.

-p, --params <JSON-file>

A JSON file containing additional parameters to pass to downstream tools.

This argument is optional.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus