How To: Use Flex 4.5 with AIR 2.5 on the BlackBerry PlayBook

Update: Troubleshooting “AIR validation failed” message. See below.

Update 2: Using Flex 4.5.1 on the BlackBerry PlayBook

Update 3: RIM has announced BlackBerry Tablet OS 1.0.6 with AIR 2.7. The workaround mentioned below is no longer required.

As you might already know, the BlackBerry PlayBook from RIM will initially be shipping with AIR 2.5, not AIR 2.6 (this is to come later in an update to the device). Flex 4.5 SDK requires AIR 2.6 as the minimum supported runtime – this is because of specific feature support (such as soft keyboard) as well as bug fixes/performance improvements. We know however that a lot of you are eager to develop Flex 4.5 applications for BlackBerry Tablet OS, so I’d like to share an unsupported workaround that you can use in the meantime.

I’ve created a playbook_overrides.swc that monkey patches the release build of the Flex 4.5 SDK to remove all AIR 2.6 dependencies. This allows you to publish a Flex 4.5 application that targets AIR 2.5. Here are some instructions to get you started. Again, keep in mind that this is an unsupported hack until (1) AIR 2.6 is available on the PlayBook and (2) Flex and Flash Builder update to 4.5.x in June 2011.

Requirements

  • Flash Builder 4.5
  • BlackBerry Tablet SDK and Plugin 1.0.1
  • playbook_overrides.zip (Contains playbook_overrides.fxpl, playbook_overrides.swc and TwitterTrendsFinal.fxp example project)

Steps

  1. Create a new Flex Mobile project with BlackBerry Tablet OS as a target platform
  2. Add playbook_overrides to the library path. This SWC patches SDK and Mobile Theme classes to remove soft keyboard dependencies. Download: playbook_overrides.zip
  3. Open Project Properties > Flex Compiler
  4. Add “-swf-version=10” in “Additional compiler arguments”
  5. Open Project Properties > Flex Build Packaging > BlackBerry Tablet OS > Advanced tab.
  6. Add “-forceAirVersion 2.5”
  7. Run/Debug to device or emulator

Troubleshooting

  1. Crash on launch (application briefly appears in launcher, then closes).
    Make sure -swf-version=10 is set in additional compiler arguments.
  2. Blank or stuck on splash screen on launch
    Usually indicates a runtime error. Could indicate an AIR 2.6 dependency VerifyError.
  3. Error dialog when packaging: “error 102: invalid namespace http://ns.adobe.com/air/application/2.6.0 Error: AIR validation failed”
    Change the namespace in your /project/src/project-app.xml from “2.6.0” to “2.6”

Next Steps

  • Refactor your project into 2 projects to target Android with AIR 2.6 support and BlackBerry Tablet OS with AIR 2.5 support simultaneously
  • Use the BlackBerry Tablet SDK for native controls in your Flex Mobile project
  • Try the TwitterTrendsFinal.fxp in the playbook_overrides.zip. This FXP already links playbook_overrides.swc and is ready to deploy. All it needs is an update to blackberry-tablet.xml to add the <author> and <authorId> of your debug token to deploy to a PlayBook.
Share on Facebook

52 Responses to How To: Use Flex 4.5 with AIR 2.5 on the BlackBerry PlayBook

  1. Julian Dolce says:

    Hi Jason,

    Will you make the playbook_overrides.swc available?

  2. Jason San Jose says:

    Forgot to upload the ZIP. Updated. Thanks!

  3. KillerSpaz says:

    Hey Jason, I ran into a (hopefully) minor issue while attempting this process.

    I did as you suggested, and even tried your included TwitterTrendsFinal project, and get the same results.

    As a quick side-note, when launching on the desktop, it seems to run as expected; this issue I’m reporting only seems to pertain to launching to a device or simulator:

    ————————
    Error occurred while packaging the application:

    Packaging failed:1
    C:\Users\\AppData\Local\Temp\bar-app6665679692599201187.xml: error 102: Invalid namespace http://ns.adobe.com/air/application/2.6
    Error: AIR validation failed
    ————————

    Let me know if I can provide any more information.

  4. Jason San Jose says:

    Looks like you’re using a prerelease build of FB. We’ll follow up on the prerelease forums. If anyone has issues with the public build, please post your issues here in comments.

  5. Dennis says:

    Hi Julian, I am having a problem publishing to the simulator using your workaround for Flash Builder 4.5 Premium. On the simulator I receive “error unable to start application”. In Flash Builder I receive the following error:

    Deployment Failed: Sending Launch request…
    Info: Action: Launch
    Info: Launching AIRHelloWorld.debug.testbG9Xb3JsZC5kZWJ1ZyAgICA…
    result::Failed
    Info: done

  6. Dennis says:

    I deleted the virtual machine and created it again and all of sudden it works. :o)

  7. Phil Haeusler says:

    Thanks for this Jason. I’ve applied this to the Flash Builder 4.5 release and I am able to debug in the simulator again.

  8. Pingback: Migrating from Flex 4.0 to 4.5 « Killerspaz's Blog

  9. Mark Z says:

    hey jason,

    im following your directions to a tee but when i go to package my flex application i get one of two errors:

    when i change the application descriptor file air version to 2.5 i get,
    namespace 2.5.0 in the application descriptor file should be equal or higher than the minimum version 2.6.0 required by flex sdk

    or, if i leave it as 2.6.0 and go to package i get,
    error 102: invalid namespace http://ns.adobe.com/air/application/2.6.0
    Error: AIR validation failed

    i have the overrides.swc in my build path as well as the library overrides.fxpl and it still wont package right..

    also your twitter trends throws me the same error as i explained above….
    any ideas?

    • Jason San Jose says:

      Don’t change the namespace in your application descriptor. That step isn’t in the instructions. If you were on pre-release, I did have older instructions that included this step. Instead, use the BlackBerry packaging option -forceAirVersion 2.5.

  10. Mark Z says:

    yeah im using the FB 4.5 release version but if i dont change the namespace i get,

    error 102: invalid namespace http://ns.adobe.com/air/application/2.6.0
    Error: AIR validation failed

    and thats with -forceAirVersion 2.5 in the packaging options, thats why im so confused

  11. Jason San Jose says:

    Does that AIR validation failed show up as a Problem in FB or as text in the Console? If it’s in the Console, it sounds like a wrong version of ADT is being used for packaging.

    Could be a bad or old BB SDK or Flex SDK w/ AIR overlay.

    • Mark Z says:

      yeah thats whats weird everything is new and updated..brand new flex 4.5 sdk bb tablet sdk 1.0.1. the problem is displayed as a pop up error in fb, nothing is displayed in the console thats why im confused.

    • Brandon says:

      I’m also having this same problem with the namespaces. Is there a resolution for this?

      • Jason San Jose says:

        If it’s a popup error, then it’s likely a bad version of ADT in your blackberry SDK. Check your SDK location and confirm that its what you expect. Go to preferences > flash builder > target platforms > BlackBerry Tablet OS and confirm the SDK path.

        You might also try creating a clean workspace in File > Switch Workspace > Other…

        • Brandon says:

          It’s not coming as a popup but as an error in the Problems section. I’ve tried both of the resolutions but they did not fix the issue. My Blackberry SDK is the latest from the download site.

          • Jason San Jose says:

            I’ve contacted RIM for some help. I’ll write up a new post when I hear back.

  12. Andy says:

    Would like to take a look at the source code for playbook_overrides.zip.
    Would it be possible for you to mail it to me?
    Thanks

  13. Brian says:

    Hey Jason,
    I am having the same issue that Mark Z is having.
    I get: error 102: invalid namespace http://ns.adobe.com/air/application/2.6.0
    Error: AIR validation failed.

    I didn’t change the descriptor and left it at 2.6. I also have the most current BlackBerry Tablet SDK 1.0.1 and the release version of FB 4.5. I saw that you said that it might be a bad ADT but I’m not getting the error in the console. Nothing even shows up in the console I just immediately get a pop up with the above error. I also uninstalled EVERYTHING and re-installed it just to make sure I am starting completely fresh. Do you have any idea what might be wrong, I’m in a huge whole here because I need to update my app but can’t get it packaged.

  14. Paul Haenel says:

    Jason,

    Do you have any news on the issue with Brian and Mark Z as i have the same issue.

  15. Brandon says:

    When I set the namespace as 2.6, it appears to work. However, the run on desktop mode in Flash Builder 4.5 launches in a portrait shaped window. Do you know how to fix how this launches? The resolutions appeared correct for the device.

  16. Jason San Jose says:

    I’ve updated to post with the fix in the troubleshooting section. Change your namespace from “2.6.0” to “2.6”. The bug is logged for RIMs next release. Thanks everyone for the feedback.

    • Jeff says:

      What if mine is 2.6 and it still doesnt work?

      • Jason San Jose says:

        Can you be more specific, what’s the error you’re getting? Same AIR validation failed?

        • Jeff says:

          yeah same error 102, just like everyone previously. so i made sure my namespace said 2.6, tried again and still get the same error. any ideas?

          • Jason San Jose says:

            Try the attached playbook_overrides.zip. In there is a TwitterTrendsFinal.fxp. Let me know if that works for you.

            For your project, try to do a clean build and double check all the other settings. Make sure you edited the -app.xml in your /src directory and not the one in bin-debug.

  17. Jeff says:

    hey jason,

    I tried what you said, cleaning the project, created a new workspace, and reinstalled everything (all the sdks and FB). I still get error 102 air packaging failed. I am using Windows 7 64-bit, if thats an issue. Also your twittertrendsfinal.fxp throws me the same exact error. I even tried changing the air-config and airmobile-config and flex-config xmls in the flex sdk to swf version 10 and player version 10.0.0 and that still didnt work, so I changed it all back.

  18. ehab fadl says:

    I started new mobile project with sdk 4.5 and did the steps you mentioned above, when I run the application it stucks with a solid white screen on desktop and playbook. when I delete -swf-version=10 it works on desktop but not on playbook………….. so nothing works on playbook….what can I do????

    • ehab fadl says:

      I’am only putting a simple list in the view which will navigate to another view after clicking an item ( I don’t think it is 2.6 dependant)

      • I’m seeing the same as Ehab. Also, when I run the debugger on the device, the application is throwing a error about not finding the class SoftKeyboardEvent. The app never seems to get to frame 2 in that even preinitialize never fires. Adding a ref to this class makes the error go away, but still never gets past the splash screen. I’ve not had the opportunity to look at the overrides SWC source yet though.

        DK

  19. Matt says:

    OK, I got it: for the “Blackberry Tablet OS target” option to appear, the simulator must be installed.

  20. Marc says:

    I’m getting the same problem.

    I didn’t get it until I tried to add in an icon.

    “Namespace 0.0.0 in the application descriptor file should be equal or higher than the minimum version 2.6.0 required by Flex SDK.”

    This is what I have.

    Whats going on here?

  21. The solution seems to work in general, but I have a problem with the Spark DataGrid. In the Playbook the app just hangs. In the FB simulator I get following error:

    Error #1034: Type Coercion failed: cannot convert mx.controls.dataGridClasses::DataGridColumn@fad70f9 to spark.components.gridClasses.GridColumn.
    at spark.components::Grid/set columns()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Grid.as:803]

    …which is caused by my code line…

    at packages.DominoUtilities::DominoMobileViewUtilities/viewcolumns_loaded()[D:\Flash Builder 4.5\FlexMobile4Domino2.0\src\packages\DominoUtilities\DominoMobileViewUtilities.as:330]

    …which is this line…

    container.addElement(this._dataGrid);

    I’m adding a Spark DataGrid object to a Spark Group container.

    Here is the full error message:

    TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls.dataGridClasses::DataGridColumn@fad70f9 to spark.components.gridClasses.GridColumn.
    at spark.components::Grid/set columns()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Grid.as:803]
    at spark.components::DataGrid$/setPartProperty()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:1136]
    at spark.components::DataGrid/setGridProperty()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:1168]
    at spark.components::DataGrid/partAdded()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:2626]
    at spark.components.supportClasses::SkinnableComponent/findSkinParts()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:736]
    at spark.components::DataGrid/findSkinParts()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:2580]
    at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:701]
    at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:443]
    at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]
    at spark.components::DataGrid/createChildren()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:2220]
    at mx.core::UIComponent/initialize()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7624]
    at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7485]
    at mx.core::UIComponent/addChildAt()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7189]
    at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:2037]
    at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:1628]
    at spark.components::Group/addElementAt()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:1387]
    at spark.components::Group/addElement()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:1345]
    at packages.DominoUtilities::DominoMobileViewUtilities/viewcolumns_loaded()[D:\Flash Builder 4.5\FlexMobile4Domino2.0\src\packages\DominoUtilities\DominoMobileViewUtilities.as:330]
    at packages.DominoUtilities::DominoDBUtilities/common_XML_result()[D:\Flash Builder 4.5\Flex4SoapgateQ2.0\src\packages\DominoUtilities\DominoDBUtilities.as:2214]
    at packages.DominoUtilities::DominoDBUtilities/dbviewcolumns_result()[D:\Flash Builder 4.5\Flex4SoapgateQ2.0\src\packages\DominoUtilities\DominoDBUtilities.as:2164]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\hero_private\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:249]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\hero_private\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]
    at mx.rpc::Responder/result()[E:\dev\hero_private\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
    at mx.rpc::AsyncRequest/acknowledge()[E:\dev\hero_private\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
    at DirectHTTPMessageResponder/completeHandler()[E:\dev\hero_private\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:451]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

  22. Ignore my last comment. Somehow the mx.DateGrid classes made it into my code stream. That obviously won’t work. I fixed my code and it is now working perfectly.

    Nice solution. Thanks.

  23. Don Kerr says:

    I’m getting the blank screen. How do I know what to look for since I’m not getting any error messages? I’m using 4.5.1 with debug token to the playbook device. But, what is weird is that debug to desktop is also now showing blank screen. Any ideas?

    The icon installs on the device, but it runs just a white screen only.

    Thanks,
    Don Kerr
    Manager, Space City Adobe User Group

  24. Andres says:

    works for me

    1. created project.
    2. added 2 lines into compiler configuration
    3. added playbook_override path to libs

    Works on latest downloaded Flex Builder and Playbook SDK 2 June 2011:
    FlashBuilder_4_5_LS10.exe
    BlackBerryTabletSDK-Air-Installer-1.0.2-Win-201105191426.exe

  25. Pingback: How to use Flex 4.5 with Air 2.5 on the Blackberry PlayBook « priyeshsheth

  26. Jack says:

    Hey.. your post was very useful as I was getting nuts chasing a solution for this issue. I’ve followed all those steps and it finally launches.
    The proplem, now, is that I’m not able to design the UI in design mode (under mxml file) because of a “circular dependency issue” between Flex 4.5’s mobile.swc and your playbook_ovverides.swc. It reports a SWC Load Error.
    Any suggestion to make it work?
    Thank you doubly, man! 😉

  27. Ben says:

    It used to work for me on Flex 4.5 but I now get the blank screen since I updated to 4.5.1. I checked and the configuration is correct.
    4.51 works for anyone?

    Best regards, Ben

    • Jason San Jose says:

      The playbook_overrides.swc will not work with 4.5.1. I’ll post a blog explanation shortly.

  28. Pingback: Using Flex 4.5.1 on the BlackBerry PlayBook « Jason's Flex Blog

  29. Ben says:

    Actually, I just had to set Flex 4.5 as compilation target in the Flex Compiler properties to make it work again. I hope RIM will release an update for AIR 2.7 soon 🙂

  30. Pingback: What is the Difference between Adobe Flex and Adobe AIR? | Adobe Expressed

  31. Saravanan says:

    Hi,

    I tried to use playbook_overrides with Flash Builder 4.5 updated to 4.5.1.
    I am getting the following error
    Class flash.events::SoftKeyboardEvent could not be found.

    Is there any solution?

    • Jason San Jose says:

      As noted in Update 3 above, this workaround is no longer required. Please use the standard project setup for SDK 4.5.1 and BlackBerry Tablet OS.

  32. Jancassio says:

    I get the error below and I don’t know what to do.

    Error occurred while packaging the application:

    Compilation failed…

    The app xml file (myapp-app.xml) has the correct air namespace:

    Yes, I use the air 2.7 and Flashbuilder 4.5

    Any idea? Solution? Workaround? Please!
    Thanks

    • Erik says:

      I’m also getting the blank screen and seriously starting to lose interest. I’m using 4.5.1 and have uninstaller, installer, cleared project, recreated projectsm tested both ADL Version 2.6.0.19120 and ADL Version 2.7.1.19610. No errors, no log no nothing. Has 4.5.1 been tested at all?

      The interesting part is that I made my code to run once or twice in the beginning but after a restart of FB it stopped working and has only worked once since then, dont ask me why. So im not sure its runtime related, seems more like Adobe has seriously damaged the build process somehow.

      • Jason San Jose says:

        Be sure that you’re not using any of the workarounds listed in this post. As I mention in the updates, this workaround is no longer required.

        Check your project to make sure you do not have -swf-version=10 or -forceAirVersion 2.5 where referenced above. Since I can’t reproduce your problem, my first suggestion is to launch an on-device debug session from your project and see if the debugger will report anything suspicious like a VerifyError.

    • Jason San Jose says:

      If you still get this error, check your workspace log for any additional information.

      Win: C:\Users\username\Adobe Flash Builder 4.5\.metadata\.log
      Mac: /Users/username/Documents/Adobe Flash Builder 4.5/.metadata/.log

  33. brij kishor says:

    I am getting below error

    Deployment Failed: Info: Sending request: Launch
    Info: Action: Launch
    Info: Launching Main.debug.testDev_Main_debug_527d75fe…
    result::Already Running
    Info: done