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

Reply
Developer
taylortbb
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

[ Edited ]

I've seen multiple people asking about this so I wanted to put together some instructions. The release procedure part mostly exists in another thread, but because I posted it as a response people are having difficulty finding it. I've also re-written this to make it easier. These instructions should work on Windows, Mac, or Linux.

 

Getting Started

 

This guide assumes you have installed the 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 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, fortunately this part only needs to be done once. To start download the sample RSS Reader from http://na.blackberry.com/eng/developers/tablet/RSSReader.fxp . The .fxp file is actually a zip file, so extract it with your favorite unzipping tool. Inside the src folder you will find a file called RSSReader-app.xml, copy this file to your development directory. You'll then need to rename the file to HelloWorld-app.xml. Open HelloWorld-app.xml in your favorite text editor. Change the <id>, <filename> and <name> to HelloWorld. For your own applications you'll need to pick a proper unique identifier for <id>. Then change the <content> to HelloWorld.swf. After that comment out the <image72x72> line. PlayBook apps have their icon determined by file name. Save your modifications.

 

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. 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 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().

 

 

 

I hope you have found this guide to be useful, if anything doesn't work for you then don't hesistate to ask.

--------
Taylor Byrnes
Please use plain text.
BlackBerry Development Advisor
elena_laskavaia
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

Thats for this excellent article about command line support.

The only note is the "icon" for tablet should be 90x90, other sizes would be re-scaled.

Since adobe does not support 90x90 tag, the icon of this size cannot be defined on the app.xml file. The proper way either call it "blackberry-tablet-icon.png" and it will picked up automatically or you can define it in blackberry-tablet.xml file which also has few other tablet specific settings. Example of this file can be found in HelloWorld example project shipped with SDK.

Please use plain text.
Developer
RottenOgre
Posts: 274
Registered: ‎11-01-2010
My Device: PlayBook?
My Carrier: WiFi

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

Thanks for this info - it was a big help in getting me started. I'm having some problems getting my own icon to show but it works if I just comment out the icon line, so I'm going that way until I sort out what the problem is with the icon.

 

Out of curiosity, how would I compile multiple .as into a .swf through the command line? I don't actually need to do it this way but I'm just curious.

 

 

@Elena: Lilliana Vess, eh? :smileywink:

Please use plain text.
Developer
taylortbb
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

 


RottenOgre wrote:

Thanks for this info - it was a big help in getting me started. I'm having some problems getting my own icon to show but it works if I just comment out the icon line, so I'm going that way until I sort out what the problem is with the icon.

 

Out of curiosity, how would I compile multiple .as into a .swf through the command line? I don't actually need to do it this way but I'm just curious.


 

I edited the icon instructions today, are you following the new ones? Including the note about blackberry-tablet.xml?

 

As for compiling multiple files, all you have to do is compile your main file. The compiler automatically finds dependencies and compiles them.

--------
Taylor Byrnes
Please use plain text.
Developer
RottenOgre
Posts: 274
Registered: ‎11-01-2010
My Device: PlayBook?
My Carrier: WiFi

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

I was using the old instructions.

 

I went to give the new ones a try just now but apparently the sim refuses to take my password (and it's in my Command Line so I know I'm not just forgetting it). I also seem to be missing that hammer icon now where you get the IP address from.

 

What fun.

 

Anyway, I'll try again tomorrow and let you know if it works.

Please use plain text.
Developer
taylortbb
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

If the hammer is missing it means you're not in development mode, you have to enable it from options after each boot.
--------
Taylor Byrnes
Please use plain text.
New Contributor
Knochi
Posts: 8
Registered: ‎10-28-2010
My Device: Not Specified

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

[ Edited ]

Hi Taylor,

 

i followed your instruction step by step, but didn't get the HelloWorld app to run.

 

When i sent the app to the simulator this "loading application" window comes up and closes again.

 

No App, nothing installed.

 

i tried the debug mode without any sucess.

 

when i unzip the .bar file, the source files are within a copy of my local folder structure, in my case:

in \air\c_\username\My Documents\BlackBerry\TabletOS\HelloWorld\

 

Any hints on this?

 

Thx

David

 

Please use plain text.
Developer
RottenOgre
Posts: 274
Registered: ‎11-01-2010
My Device: PlayBook?
My Carrier: WiFi

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

Reinstalled the simulator...

 

Now everything works fine. Followed the new instructions for the icon and it works perfectly.

 

Thanks again!

Please use plain text.
BlackBerry Development Advisor
elena_laskavaia
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

Knochi you are hitting issue with packager which is described in release notes.

Add option -C <working_directory> before other flags for blackberry-airpackager, i.e.

 

blackberry-airpackager -C \air\c_\username\My Documents\BlackBerry\TabletOS\HelloWorld\ -package ...

Please use plain text.
New Contributor
Knochi
Posts: 8
Registered: ‎10-28-2010
My Device: Not Specified

Re: HOWTO: Compile and Debug without Flash Builder, using command line (works Win/Mac/Linux)

Got it to work!

The directory containing your source code mustn't contain blank characters!

 

moved the source to a simple directory and worked!

 

 

 

Please use plain text.