Having an Android phone and iPhone in addition to a BlackBerryAugust 17, 2012
This week I decided that in addition to owning a BlackBerry, I should own an Android device and an iPhone. I feel this way because never having owned an Android or iPhone, I feel somewhat ignorant. I want to have a clear sense in my head how well various use cases are executed on each of the leading platforms.
I also think it would be useful to be able to experience the leading apps on each of the platforms. As an app developer, it's a shame that I have no idea what the top Android and iPhone apps are, or what they're like.
Another pull is that, working for Wolfram Alpha, I want to be able to play with devices that integrate our knowledge engine: Siri and S Voice. Back in October, before I had had so much success on App World, I almost switched from BlackBerry to iPhone because of Siri. Siri represents many of my CS passions converging, so not having Siri is a bit odd for me.
I bought a Samsung Galaxy S III today from Wind Mobile, and I've been delighted with the device as I played with it this afternoon. I will share my early thoughts in a separate post.
Converting PlayBook AIR apps to BB10August 17, 2012
Now that I've
gotten past the strange compilation errors I was running into, I can make some forward progress on figuring out how to get PlayBook AIR apps compiled and running using the BB10 AIR SDK.
Given how important it is for RIM to get developers to bring their PlayBook apps to BB10 prior to launch, it seems extremely odd to me that they haven't given devs a guide on how to port PlayBook apps to BB10. RIM is doing a lot of things right with their recent developer relations efforts, but this isn't one of them. I mentioned this to Garett (RIM developer relations) when we chatted for an hour, and he got back to me that a guide for converting PlayBook apps to BB10 was planned but not currently available.
So, I'm left to hack around and see if I can figure it all out...
Version of AIR: 3.1
UberschallSamsara pointed out to me that the version of AIR required by the BB10 AIR SDK is 3.1. This was a surprise to me since the installer says:
Please select the folder of the existing Adobe® AIR® SDK 2.6 or higher installation. You can download the latest AIR SDK from http://www.adobe.com/products/air/sdk. Or select the folder of the existing Adobe® Flex® SDK 4.5 or higher installation.
|
|
I took a look on RIM's website to see if I could find any reference to 3.1 being required and found it
here. One can find this page by clicking on the "Requirements" link below the installation button on
this page. If 3.1 really is required, then it seems like a bug that the installer says "Adobe® AIR® SDK 2.6 or higher". Others on the forum suggest that 3.1 is the highest version that can be used, so perhaps version 3.1 isn't strictly required, although the requirements page previously mentioned does explicitly say "Adobe® AIR® SDK 3.1 or higher".
The link on the requirements page actually takes you to a download page for AIR 3.3 as of August 17 2012.
Version of AIR SDK in App XML file
UberschallSamsara pointed out to me that the version of AIR is actually specified in the app XML file, which I hadn't noticed before. This probably explains some problems I ran into trying to get PlayBook apps to compile with more recent versions of the PlayBook SDK. (I had to append the
-swf-version=10 option to the
mxmlc command)
Extensions in App XML file
After examining the
Creating your first application with the Command Line Tools page, I noticed the following in the app XML file:
<extensions> <extensionID>qnx.fuse.ui.skins.QNXSkins</extensionID> </extensions>
|
|
It would appear that this is now required to be in your App XML file.
Referencing ANE files when running blackberry-airpackager
After examining the
Test applications using the command line page, I noticed that ANE files must be referenced when running
blackberry-airpackager.
Code changes required to compile
The following is a log of changes that I needed to make to the code to get it to compile, and any frustrating things that I came up against.
  | Many global replacements were required, so I downloaded a Windows Grep to help out. See here. |
  | Global search & replace: |
 | Old: import qnx.dialog.AlertDialog; New: import qnx.fuse.ui.dialog.AlertDialog; |
  | The above (and possibly other things below) may be necessary due to changes made to the AIR framework prior to BB10, although I'm not completely sure. |
  | Global removal: |
 | alert.dialogSize = DialogSize.SIZE_MEDIUM; or: alert.dialogSize = DialogSize.SIZE_SMALL; It would appear that BB10 doesn't support this form of dialog size specification. |
  | Global removal: |
 | import qnx.dialog.DialogSize; |
  | Global search & replace: |
 | Old: qnx.dialog New: qnx.fuse.ui.dialog |
  | Global search & replace: |
 | Old: qnx.ui. New: qnx.fuse.ui. |
  | Global search & replace: |
 | Old: flash.text.TextFormat New: qnx.fuse.ui.text.TextFormat |
  | The Image class no longer supports the setSize method, so .width and .height need to be set explicitly. |
Additional changes required
At this point, I was able to get my app to compile and start.
  | Because the app was designed for the PlayBook, I made it landscape-only. This isn't ideal for BB10 since BB10's default orientation is portrait. |
 |   | Created new graphics in Photoshop for BB10. |
  | None of my labels were showing up because the textWidth property of Label was returning NaN. |
 | Forum post This forum post has since been answered and has got me up and running, although I'm still confused as to whether this is a bug or by design. I think it's a bug. |
Once I got this far, things roughly worked. Additional things that needed changing:
  | I used a NavigationPane on the Help screen with a "Back" button rather than my home-brewed "Done" button. |
  | I struggled quite a bit trying to get scrolling working on the Help screen. The scrolling mechanisms I was using on the PlayBook didn't work in BB10, and the scrolling mechanisms in BB10 took some cajoling to get working. Looks like RIM may have some bugs to fix in this area. |
Getting simple BB10 AIR apps to compileAugust 16, 2012
I've created about 30 PlayBook apps over the last year and a half and it has come time to start getting them up and running on BB10, especially since RIM now allows them to be submitted to App World.
Unfortunately, I haven't been able to get even very simple apps to compile, such as:
package { import flash.display.Sprite; import qnx.fuse.ui.dialog.AlertDialog;
[SWF(width="1024", height="600", backgroundColor="#FFFFFF", frameRate="30")] public class Example extends Sprite { public function Example() { var alert:AlertDialog = new AlertDialog(); alert.title = "Debug"; alert.message = "Hello, world!"; alert.addButton("Ok"); alert.show(); } } }
|
|
I have attempted to compile this with:
set JAVA_HOME=E:\Program Files (x86)\Java\jre7 set PATH=%PATH%;E:\Program Files\Research In Motion\blackberry-tablet-sdk-3.0.0\bin
cd E:\Users\Daniel\Dropbox\Apps\ExampleBB10\ amxmlc Example.as
|
|
But get the errors:
Loading configuration file E:\Program Files\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\air-config.xml E:\Users\Daniel\Dropbox\Apps\ExampleBB10\Example.as(13): col: 14 Error: Type was not found or was not a compile-time constant: AlertDialog.
var alert:AlertDialog = new AlertDialog(); ^
E:\Users\Daniel\Dropbox\Apps\ExampleBB10\Example.as(13): col: 32 Error: Call to a possibly undefined method AlertDialog.
var alert:AlertDialog = new AlertDialog(); ^
E:\Users\Daniel\Dropbox\Apps\ExampleBB10\Example.as(14): col: 16 Error: Call to a possibly undefined method AlertDialog.
alert = new AlertDialog(); ^
E:\Users\Daniel\Dropbox\Apps\ExampleBB10\Example.as(6): col: 27 Error: Definition qnx.fuse.ui.dialog:AlertDialog could not be found.
import qnx.fuse.ui.dialog.AlertDialog;
|
|
I am basing this on what RIM has provided:
Using the AlertDialog:
https://developer.blackberry.com/air/beta/documentation/create_alert_dialog.htmlCompiling with the command line:
https://developer.blackberry.com/air/beta/documentation/create_your_first_application_cmd_ms_2010847_11.htmlThis is a call to RIM to please provide adequate instructions for how to compile BB10 AIR apps via the command line.
I have searched the forums and found evidence of others having issues. There are some hints on how to get things working, but those hints are mostly with respect to the IDEs that some people use to develop AIR applications.
It's really a sad state of affairs that a person like myself can't even get a simple BB10 AIR app to compile in August 2012!
I've posted to the
forums in hope of an answer. Hopefully this will all be clarified soon.
Update: As recommended by someone on the forums, deleting the SDK directory and reinstalling seems to have fixed this issue. (I did notice that the version I re-downloaded was "beta 2", so it's possible that this issue was fixed at some point)
older >>