Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Compile and Debug without Flash Builder Using a Command Line

by BlackBerry Development Advisor on ‎11-04-2010 03:44 PM (18,430 Views)

Getting Started

 

This guide assumes you have installed the BlackBerry® PlayBook SDK.  It is not meant to cover how to get it installed. However, it should be noted, if you are developing on Linux you can just copy the installation directory from a Windows® install. RIM has not released a proper Linux installer, so you won't find instructions for it. This guide also does not cover installing the BlackBerry® Playbook Simulator.

 

This guide also assumes you have added the SDK's bin folder to your default path. If you have not then you will have to prefix each command with the path to the SDK's bin folder.

 

We're also going to assume that in a directory you have a file called HelloWorld.as you wish to compile.

 

Standard Release Procedure

 

First off, we're going to compile our source code to a .swf file.

 

 

amxmlc HelloWorld.as

 

 

In your development directory you should now have HelloWorld.swf. This is the binary for your program, it now has to be packaged.

 

Before we can package it we will need a XML info file and an icon.  Here is an example of the XML you can use:

 

 

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/2.5">
<id>net.example.test</id>
<filename>test</filename>
<name>test</name>
<versionNumber>1.0.0</versionNumber>
<copyright>Example Inc.</copyright>
<initialWindow>
<content>test.swf</content>
</initialWindow>
</application>

 

You'll need to modify this to suit your application, creating your own id, filename, name, version and content.  Use HelloWorld.swf in the content section to match the application we're creating in this article.  Once complete, save this file in your development directory as HelloWorld-app.xml.

 

You now need to copy a PNG icon of size 90x90 into your development folder, assuming you aren't using the default icon (default icon not recommend for production applications). The name must be blackberry-tablet-icon.png.

 

For production applications you should also include a blackberry-tablet.xml file. You can find a sample of this file in the HelloWorld project that is included with the SDK. If you're just getting started this file is not required, so these instructions assume you do not have one.

 

Now it's time to package and deploy your application. You should already have the simulator running with development mode enabled. You have to change directory to one containing the xml and swf file. Your command is:

 

 

blackberry-airpackager -package HelloWorld.bar -installApp -launchApp HelloWorld-app.xml HelloWorld.swf [ICON FILE NAME] -device [PLAYBOOK IP ADDRESS] -password [SIMULATOR PASSWORD]

 

 

Your app should now package and deploy. You may not require the password option depending on what you have done in the simulator. You can omit the icon file name if using the default icon. You can include any additional resource files your application requires in the list of files.


Debugging Procedure

 

This procedure assumes you've already followed the standard compile and deployment procedure. If not you'll need to follow the steps relating to the XML file and icon before this procedure will work.

 

First, we need to compille your app with debugging enabled. Your command is:

 

 

amxmlc -compiler.debug HelloWorld.as

 

You should now have a HelloWorld.swf file which is somewhat larger (file size) than the .swf file produced by the standard procedure.

 

Open a second console and run:

 

 

fdb

 

 

Once the Flash Debugger opens issue the command:

 

 

run

 

Immediately switch back to your previous console. The Adobe® Flash® debugger times out if nothing connects within about 60 seconds.

 

 

We now deploy your app for debugging using the command:

 

 

blackberry-airpackager -target bar-debug -connect [YOUR COMPUTER'S IP ADDRESS] -package HelloWorld.bar -installApp -launchApp HelloWorld-app.xml HelloWorld.swf [ICON FILE NAME] -device [PLAYBOOK IP ADDRESS] -password [SIMULATOR PASSWORD]

 

Your application should deploy and connect to the debugger you have open in the other window. Switch back to the console where the debugger is running. Be patient as it can take a bit before the simulator connects. If you have a firewall it can interfere with the simulator's ability to connect, make sure port 7935 is open. When the simulator connects you will be prompted to enter breakpoints. The use of Flash Debugger is outside the scope of this tutorial, there is a built-in help function. If you just want console output then issue the command:

 

 

continue

 

This will let your application start execution and no breakpoints will be set. You will get console output of things such as trace().

Comments
by New Developer
on ‎01-05-2011 06:16 AM

I had some issues getting my apps to run. They would only show the loading screen and crash.

 

The solution to this issue is to add

 

-C <working directory> 

 

before the some-app.xml location.

 

 

Users Online
Currently online: 38 members 1,462 guests
Please welcome our newest community members: