Playbook Development with FDT and ANT

I just put up a sample FDT project on github which gets you started with BlackBerry Playbook development with FDT. I comes with an ANT build.xml which pretty much does all the work for you.

https://github.com/formatlos/hello-playbook-with-fdt

Setting up Playbook SDK and Simulator

There are a few good tutorials out there which explains the setup process in detail, so I don’t want to bother you with that … and it’s really straightforward anyway.

http://us.blackberry.com/developers/tablet/devresources.jsp
http://www.12robots.com/index.cfm/2010/11/21/Getting-your-BlackBerry-PlayBook-development-environment-set-up–Part-One

Setting up FDT

First of all you need to setup an ANT property. Go to Eclipse Settings -> ANT -> runtime -> Properties -> Add Property and type in the name “BB_TABLET_SDK_HOME” and as value the path to your installed Playbook SDK. Insert another property with the name “FLEX_HOME” and point it to the same location … you’ll need this to use the mxmlc task.

ANT property

SDK

The Playbook SDK is basically just a AIR SDK with a little extra spice … so you can add the SDK to your FDT settings like you do with every other SDK.

Project

After that you can create a new project or download my sample project from github. Create “Empty AS3 AIR Project” and select the installed Playbook SDK in my case “BlackBerry Tablet OS SDK 0.9.1 for Adobe AIR”.

your project structure should look like this:

FDT doesn’t add the blackberry specific SWCs automatically to the project, you have to do this step manually. To do that open your project properties -> FDT Build Path -> SDK Library -> Select SWCs and select the blackberry.swc, qnx-screen.swc and qnx-air.swc …

that’s it!! now you can use the build targets to compile your App and deploy it to the simulator.

Debugging Procedure

After running the debug-deploy target you’ll probably look for any trace output. The SDK ships with another tool you can use to debug your App it’s called fdb. Open a terminal window and launch the fdb tool, once the Flash Debugger opens issue the command “run”. The debugger times out if nothing connects within about 60 seconds, yo you should immediately start you debug-deploy target after running the debugger.

Your application should deploy and connect to the debugger  but probably it’ll 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. If you don’t want to add any breakpoints just type “continue” and your Application will start up and you’ll see the trace output in you terminal.

 



25 Responses (Add Your Comment)

  1. Worked beautifully. Thanks so much for sharing your work and instructions… this is fantastic.

  2. Hey Martin, excellent read. Managed to get it working with the new SDK as well, though the debugging process is still cumbersome. There’s got to be some easier way to get your traces into Eclipse/FDT. :)

  3. @Doccie have you tried SOSMax? Not integrated in FDT but should do the job.

  4. I have some problem when compile project:

    Buildfile: D:\Development\FDT4\Workspace\HelloPlaybook\build.xml
    clean:
    debug-compile:
    [echo] === compile class D:\Development\FDT4\Workspace\HelloPlaybook/src/HelloPlaybook.as to D:\Development\FDT4\Workspace\HelloPlaybook/bin/HelloPlaybook.swf ===

    BUILD FAILED
    D:\Development\FDT4\Workspace\HelloPlaybook\build.xml:70: The following error occurred while executing this line:
    D:\Development\FDT4\Workspace\HelloPlaybook\build.xml:182: FLEX_HOME must be set to use the Flex Ant Tasks

    Windows 7 64x

  5. completely forgot about that one.
    in order to use the MXMLC task you have to set the FLEX_HOME property.
    just point it to the same location than BB_TABLET_SDK_HOME

  6. another error when deploy example program:

    Buildfile: D:\Development\GitHub\hello-playbook-with-fdt\build.xml
    clean:
    debug-compile:
    [echo] === compile class D:\Development\GitHub\hello-playbook-with-fdt/src/HelloPlaybook.as to D:\Development\GitHub\hello-playbook-with-fdt/bin/HelloPlaybook.swf ===
    [mxmlc] ???????? ????? ???????????? D:\Development\SDKs\blackberry-tablet-sdk-0.9.2\frameworks\air-config.xml
    [mxmlc] D:\Development\GitHub\hello-playbook-with-fdt\bin\HelloPlaybook.swf (255230 ????)
    debug-deploy:

    BUILD FAILED
    D:\Development\GitHub\hello-playbook-with-fdt\build.xml:85: Execute failed: java.io.IOException: Cannot run program “D:\Development\SDKs\blackberry-tablet-sdk-0.9.2\bin\blackberry-airpackager” (in directory “D:\Development\GitHub\hello-playbook-with-fdt\bin”): CreateProcess error=193, %1 ?? ???????? ??????????? Win32

    Total time: 4 seconds

    My “D:\Development\SDKs\blackberry-tablet-sdk-0.9.2\bin\” folder:
    http://twitpic.com/3vto11

    Windows 7 64x

  7. you have to use the windows equivalent “blackberry-airpackager.bat”

  8. Thank you very much!)

    But I’ve another problem w/ debug application.

    my computer ip address:
    http://twitpic.com/3vum7k

    my build.xml
    http://twitpic.com/3vuhxu

    problem w/ debuggin’ in playbook emulator:
    http://twitpic.com/3vun30

  9. another happy clone on osx with fdt 4.2!

    great ant script, just don’t forget to set your device password and id.

    wasn’t able to try debugging yet as i’m behind a corporate firewall i have no control over. i use flashconsole most of the time anyway :)

    i’m curious about your usual workflow–do you test your application most of the time as a native/desktop air application, then build for playbook once in a while? or do you build for playbook with every change?

    big thanks for this ant script and project!

  10. Great post! Thanks for the build file! Got it all working on the simulator but couldn’t get the debug to work.

  11. Debugging fine now, check the host IP is also changed I missed it first time.

    I’m trying to use robotlegs.swc as a shared library and even though I have it on the build path(put it the libs folder) the compiler throws errors as it can’t find the Robotlegs classes. Any ideas why this would be?

    Thanks,

  12. I’m using robotlegs.swc as well and a lot more swc files within that structure and it works just fine.
    Maybe you try to hardcode library-path in the macro_mxmlc just to check if this works for you.

    Anyone else having problems with that?

  13. Has anyone using this build script gotten a splashscreen to work? I don’t see a file corresponding to the blackberry-tablet.xml described at http://docs.blackberry.com/en/developers/deliverables/23959/Configuring_your_application_1524626_11.jsp

  14. I got it! Created a blackberry-tablet.xml next to the the other XML files, added a blackberry-tablet.xml property to the and script and stuck that property in the debug-deploy and release-create-package tasks. Big ups!

  15. sorry I didn’t have the time to add the blackberry-tablet.xml to the sample project. now it’s in there as well. cheers

  16. I replaced my build.xml with your new file, to get the splash screen to work, and not I get the following error:

    BUILD FAILED
    C:\Users\Scott\Development\FDT\Workspace\Dunkkkin\build.xml:86: Execute failed: java.io.IOException: Cannot run program “C:\Users\Scott\Development\SDK\blackberry-tablet-sdk-0.9.4\bin\blackberry-airpackager” (in directory “C:\Users\Scott\Development\FDT\Workspace\Dunkkkin\bin”): CreateProcess error=193, %1 is not a valid Win32 application

    I can’t see how why this would suddenly occur?

    Cheers,

    Scott

  17. like mentioned above, you have to use the windows equivalent “blackberry-airpackager.bat” when working on windows

  18. Cheers Martin, I should have remembered as I changed this in the original project template. You probably already know but I received an email from RIM telling me the app icon has to be 86×86.

  19. Thanks, Great post!

    When I run the fdb tool and then launch the debug deploy the simulator always throws the error “unable to connect to host N/A please enter correct IP” even though I have entered the IP into the build.xml. When I enter the IP at this stage it works fine. Do I need to add something to my compiler arguments as it is very annoying having to enter the IP address everytime I want to debug.

    Thanks again

  20. Arthur Oliveira June 5, 2011
    at 9:02 am

    Hello, Thank you for the post, it was very helpful. I am just having one problem. in my lib folder, I have also classes .as, how can I add the lib folder to my source? Thank you

  21. putting

    <source -path path-element="${project.lib}"/>

    after

    <source -path path-element="${project.src}"/>

    (line 197) should do the magic ;)

    cheers Martin

  22. Hi Martin,

    Just tried your ANT scripts to build and deploy a PlayBook 2.0 app on FDT 5, works fine, Thanks for these!
    I had to add signing parameters for release compile, and -devMode for debug compile.

    A propos, did you find a more integrated way to debug PlayBook Apps nwith FDT?

  23. Hi Martin. I bumped into your post while doing a pass for my next “Elsewhere…” post at OpenBBNews. Want to send me mail to touch basis on where you are, and so I can give you extra visibility? Email is on the comment information.

    – Eduard/o

Trackbacks:

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Other Entries

About

Martin Rädlinger is an Interactive Developer & Designer. He specializes in interactive coding predominantly with ActionScript, but every new challenge is welcome. If you like his work feel free to get in touch with him. At the moment he's available for freelance work.

Contact

Martin Rädlinger
mail: mr [at] formatlos.de
web: www.formatlos.de
xing: Martin Rädlinger
linkedin: Martin Rädlinger
skype: martinraedlinger