Some notes on building my first WebWorks app.
I figured the quickest way to get an app up and running would be to take the examples from BlackBerry.
Working from https://github.com/blackberry/WebWorks-Samples/tree/master/UIExamples I first did a git clone, but then reading the documentation I downloaded a zip of the UI examples instead.
The documentation talks about downloading a zip, unarchiving it, shuffling things around, and rearchiving it. The first problem I came across (on a Mac) doing this was Apple’s resource forks screwing up the zip:
Next up, another packaging problem: despite following the documentation (or so I thought), I could not get bbwp to build my package:
It turns out I was doing it wrong – the config.xml needs to be at the same level as the containing folder (http://stackoverflow.com/questions/4433092/package-my-first-blackberry-widget-xml-file-not-found). A tweak to the layout and then:
zip -r UIExamples.zip UIExamples config.xml
That fixed the packaging problem (both with missing files and with Mac resource forks). The next error I got was “Spinner not found”:
There’s quite a few extra steps you need to go through to add the UI Spinner extension, which can be summed up as:
- download the SpinnerControl zip
- extract the zip
- create the /Developer/SDKs/Research In Motion/BlackBerry WebWorks SDK 184.108.40.206/ext/blackberry.ui.Spinner directory
- copy the library.xml file into that directory
- copy the blackberry-WebWorks-Community-APIs-4d7c20a/Smartphone/SpinnerControl/src/blackberry folder into the ext/blackberry.ui.Spinner directory.
Phew. The packaging will then work:
I think there’s some optimisation that could be done on this process. In general the WebWorks development seems to involve a lot of copying files here and there.
One thing that wasn’t clear was where the output package went. I was running
… but although it declared success, I could find no output. So don’t do this. It turns out you need to add -o (picked up from Lukasz‘ excellent presentation on differences between Enyo and WebWorks):
./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/UIExamples.zip -o /tmp/
This gives two folders, OTAInstall and StandardInstall, which contain a bunch of files with .cod, .jad, .cso, .csl, .alx extensions. No idea what these are – I guess I’ll find out as I continue to explore.
Now I’ve got a packaged app, what do I do now? Next up: time to try out the emulator.
Update: turns out I’m not quite right about the folder structure and location of config.xml – although it worked, when you deploy it on a phone it fails. Instead you have the config file at the same location as your resources, and do the zipping of the contents of the project, rather than the project folder:
zip -r UIExamples.zip *
And then package:
./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/ProjectRoot/UIExamples/UIExamples.zip -o /tmp/bbwp/
… and it works on the phone as well.