The BlackBerry OS SDK currently only supports Flash Builder 4.0.1, not Flash Builder 4.0. When following steps described in BlackBerry’s own Getting Started Guide to launch your app in the simulator, users of Flash Builder 4.0 will get an internal error:
An internal error occurred during: "Launching [your project name]".
To overcome this, either download the 261MB patch from adobe, or use the command line packager which comes included with the BlackBerry OS SDK.
Using the command line packager
In essence, there is only one command that you’ll need, the syntax is:
blackberry-airpackager -package output_bar_file_name -installApp -launchApp
project_name-app.xml project_name.swf any_other_project_files
What you’ll need: your project name, your BlackBerry simulator’s IP address, the .swf of your project which is compiled by Flash Builder using the normal tools (Project->Build Project or export release build). And remember the output_bar_file_name must end with the extension .bar. If you forget this, however, the error describes it quite plainly to you. For me, a working command looks like (where “AirTest” is my project name):
blackberry-airpackager -package AirTest.bar -installApp -launchApp AirTest-app.xml AirTest.swf -device 192.168.92.128
(If you are not familiar with running commands in windows, you need to add the path to blackberry-airpackager.bat in your system’s “path” environment variable.)
Do I have to run that manually everytime?
Fortunately, you don’t. The command can be configured as a builder in Flash Builder 4.
- Go to Project->properties, and under Builders, click on the “New” button to add a new builder. Select type Program, give a name to the builder (any will do, I named mine “BBLauncher”).
- Enter the path to your blackberry-airpackager.bat in the location field. Mine was:
D:Program FilesAdobeAdobe Flash Builder 4sdksblackberry-tablet-sdk-0.9.0binblackberry-airpackager.bat
- Enter the path of your project in the working directory (the folder where you find your main .as file, likely your current “src” directory).
And Lastly, in Arguments, enter the options of the command:
-package AirTest.bar -installApp -launchApp AirTest-app.xml AirTest.swf -device 192.168.92.128
Move this builder to after “Flex” and “AIR application.xml Builder”, and you are done. From now on you can launch the app in the simulator by doing a Project->Build project.