WebWorks Resource Name Not Valid Workaround

I’ve been looking at using Phonegap and Dojo for rapid application development on mobile devices. As I have been doing blackberry development for the past year or so I thought that this would be a good platform to start on. However, I almost immediately ran into a problem with the WebWorks packager.

The problem is that the packager will not permit paths with special characters in them – special characters including the somewhat limiting “_” and “-“. Instead of packaging the files it would return the error Invalid widget archive – resource name is not valid This is especially a problem with dojo and it commonly uses these conventions for stylesheets and js files.

After Googling, I found that this behaviour was by design. It seems that if you pass a file with a dash in it, the RAPC compiler thinks that it is a command line switch.

Fortunately, RIM has recently open sourced the Webworks API. I knew from my experience with bb-ant-tools that you were able to pass a file containing paths to the files to include in the package, thus circumventing the problem with the command line switches.

The packager now successfully packages _bad-path.txt.

To patch your webworks packager, download WebWorksPatched extract it and move the bbwp.jar to your webworks bin folder (Usually C:\Program Files\BlackBerry WebWorks Plug-in Eclipse\plugins\net.rim.browser.tools.wcpc_1.5.1.201010291444-22\wcpc\bin).

For the brave of heart, source code is available on GitHub at https://github.com/51systems/WebWorks

, , ,

  1. #1 by Matt on May 21, 2011 - 5:44 pm

    Thank you for posting this. It’s mid-May 2011 and the problem still exists in WebWorks. Do you have any other development tips that you have picked up with BB along the way? I’m just getting started in BB development, and it has been a little frustrating on several fronts.

  2. #2 by Dustin on May 23, 2011 - 7:39 pm

    I believe this problem may have been resolved in webworks SDK 2.0, however this isn’t the version that is shipping with the Eclipse IDE download as of a few weeks ago.
    I’ve done a bunch of Java dev for BB, not a lot of the webworks so I am still new in that regard. My best advice is to keep at it, and use the knowledge base and forums. The documentation can be pretty thin in some areas and the API is broken in some cases so it’s an uphill battle

(will not be published)