Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a
Accepted Solution

The bar-descriptor.xml file (and making the app from command line)

I've made a game with AIR and it is online for sale on both Android and iOS. It's somewhat popular and I've been thinking about putting it up on Blackberry for quite some time now and with the soon-to-start Port-A-Thon this seems like an excellent time to finally do it.

Blackberry is not very common here where I live in Sweden, however it still looks like an interesting platform with potential so I want to get on the ride. Sadly I don't own a device myself so I will be using the simulator. Having some graphical issues with the simulator when running in the BB10DevAlpha mode (icons doesn't show up right) and the simulator is very slow when running in the BB10DevAlphaSafe mode (graphics show up right but it seems like updating them requires more CPU than my computer have available).

The game is built using nothing else than Adobe Flash Professional CS6 and a bunch of command line tools for building the package and signing it. I've only got a old computer with Windows XP right now since my main PC died a little while ago and since the Port-A-Thon is just a few days away I must make do with what I got.




First of all I understand that only AIR 3.1 is supported in Blackberry 10, so I use the old AIR SDK 3.1 to create a SWF (flash) file.

All I really need to do should be to used the exported SWF file of the game and then use the command line tools provided by RIM to build the package, right?

Except that I didn't count on bar-descriptor.xml to be so difficult to understand.




I've been scoping out the docs here: https://developer.blackberry.com/air/documentation/bb10/bar-descriptor_config_file.html

It says Adobe AIR at the top, the platform selected is Blackberry 10 and the title says "bar-descriptor configuration file", so this must be the right place!

I begin with trying out the "Sample bar-descriptor configuration file" on that page:

===========================================================

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<qnx>
   <initialWindow>
      <systemChrome>none</systemChrome>
      <transparent>false</transparent>
   </initialWindow>
 
   <!--  Name of author which is used for signing. Must match the developer
         name of your development certificate -->
   <author>Author Name</author>
 
   <!--  Unique author ID assigned by signing authority. Required if using
         debug tokens -->
   <authorId>gXXXxXXx##XxXxXxxxXxXX#xxx</authorId>
 
   <!--  The category where the application appear. Either core.games or
         core.media-->
   <category>core.games</category>
 
   <!--  The icon for the application which should be 86x86 -->
   <icon><image>icon.png</image></icon>
 
   <!--  The splashscreen that will appear when your application is launching.
         Should be 1024x600. -->
   <splashscreen>helloworld-splash.png</splashscreen>
 
   <!--  The permissions requested by your application. -->
   <permission>read_geolocation</permission>
   <permission>use_camera</permission>
 
   <!--  Fourth digit segment of the package version. First three segments are
         taken from app description versionNumber tag.
         Must be an integer from 0 to 2^16-1 -->
   <buildId>1</buildId>
</qnx>

===========================================================

Naturally when testing I replaced some stuff in the above example with the correct file names for images etc, I just copied the example straight-off this time to show you guys what I mean.

First I extract "blackberry-tablet-sdk-3.0.0" to a folder on the disk, then I make sure a full path to the "bin" folder inside the SDK can be found inside the path environmental variable on the OS.

Then I read up on "Test applications using the command line": https://developer.blackberry.com/air/documentation/bb10/testing_your_application_cmd_ms_2010851_11.h...

Now I run:

blackberry-airpackager.bat -package myappname-blackberry-new.bar -installApp -launchApp myappname-blackberry-bar-descriptor.xml myappname.swf myappnameicon86.png bg splashscreen1024.png -device 192.168.8.128

Notice that "bg" is a folder with 500 images that must be accessible from the app. I hope I can just add the folder like this and not have to type a path to each image file...

What I get (in lib\adt.jar via the bat file):

error 101: Namespace is missing
Error: AIR validation failed




Okay, so the example didn't work straight out the box.

Now I read all of the subsections of the first URL I linked to above ("bar-descriptor configuration file"). I start my XML file clean and make sure to include everything that is marked as "Required". This is what I end up with:

===========================================================

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<qnx>
    <author>MyCompany</author>
    <configuration>
        <!-- <authorId></authorId> -->
        <id>com.mydomain.myappname</id>
        <name>My App Name</name>
        <platformVersion>3.0.0</platformVersion>
        <splashscreens>
            <image>splashscreen1024.png</image>
        </splashscreens>
        <versionNumber>1.5.0</versionNumber>
    </configuration>
    <action system="true">run_native</action>
    <invoke-target id="com.mydomain.myappname">
        <invoke-target-type>application</invoke-target-type>
        <filter>
            <action>bb.action.VIEW</action>
            <mime-type>application/octet-stream</mime-type>
        </filter>
    </invoke-target>
</qnx>

===========================================================

I've no idea what the whole invoke-target block is for but it's required so it has to be there.

Now I run (notice that myappnameicon86.png is gone since no icon is mentioned in the XML above, it isn't required):

blackberry-airpackager.bat -package myappname-blackberry-new.bar -installApp -launchApp myappname-blackberry-bar-descriptor.xml myappname.swf bg splashscreen1024.png -device 192.168.8.128

Again I get:

error 101: Namespace is missing
Error: AIR validation failed




Frustrated I search around on forums for answers, because the official documentation is getting me nowhere.

I end up with this:

===========================================================

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/3.1">
    <id>com.mydomain.myappname</id>
    <versionNumber>1.5.0</versionNumber>
    <versionLabel/>
    <filename>My App Name</filename>
    <description/>
    <name>My App Name</name>
    <copyright/>
    <initialWindow>
        <content>myappname.swf</content>
        <systemChrome>standard</systemChrome>
        <transparent>false</transparent>
        <visible>true</visible>
        <fullScreen>true</fullScreen>
        <aspectRatio>landscape</aspectRatio>
        <renderMode>gpu</renderMode>
        <autoOrients>false</autoOrients>
    </initialWindow>
    <icon>
        <image36x36>myappnameicon36.png</image36x36>
        <image48x48>myappnameicon48.png</image48x48>
        <image72x72>myappnameicon72.png</image72x72>
    </icon>
    <customUpdateUI>false</customUpdateUI>
    <allowBrowserInvocation>false</allowBrowserInvocation>
    <extensions>
        <extensionID>qnx.fuse.ui.skins.QNXDevice</extensionID>
        <extensionID>qnx.fuse.ui.skins.QNXNetwork</extensionID>
        <extensionID>qnx.fuse.ui.skins.QNXSensors</extensionID>
        <extensionID>qnx.fuse.ui.skins.QNXSkins</extensionID>
    </extensions>
</application>

===========================================================

Looks similar to the XML I use when I build for Android.

First of all it doesn't have the qnx root tag but also none of the the icons are of the required size (86x86). The required splashscreens tag and invoke-target is also missing, to name a couple. No idea what the entire "extensions" block really do.

Surely this can't work:

blackberry-airpackager.bat -package myappname-blackberry-new.bar -installApp -launchApp myappname-blackberry-bar-descriptor.xml myappname.swf QNXDevice.ane QNXNetwork.ane QNXSensors.ane QNXSkins.ane myappnameicon36.png myappnameicon48.png myappnameicon72.png bg -device 192.168.8.128

Success in building the BAR package, to my infinite surprise!

It even was successful in installing it on the simulator. An icon for the game shows up. However when it auto-ran the app it went into landscape, thought for a second and then crashed (or exited?) with no message.

Maybe because the required qnx tag was missing from the XML?
Maybe because images from the bg folder couldn't be loaded?
Maybe because it didn't have permission to keep the screen from dimming?

I have no idea. I tried to append the previous qnx XML code to the bar-descriptor.xml, I thought maybe it needed both the qnx block for when running the app and the application block for when making the package. But now it complained about something like the XML not being clean ("Fatal Error: The markup in the document following the root element must be well-formed.").




So it has come to this, I have to ask for help if I'm ever going to make the deadline of the Port-A-Thon.

1) How am I supposed to write the bar-descriptor.xml?
2) Which command line starting with "blackberry-airpackager.bat" is correct to use?
3) All I need to do is build the SWF using Adobe Flash Professional CS6 and then package it using the Blackberry SDK, right?

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: The bar-descriptor.xml file (and making the app from command line)

First of all, there are two xml files that you need.

 

One is called the manifest, is for AIR, and is called yourappname-app.xml. It is identical to the ones you use for Android and IOS, though some of the elements will be disregarded. This is the one that you need to pass on the command line, and is probably causing the "Namespace missing" error. A minimal manifest file is:

 

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/3.1">

	<id>com.example.appname</id>
	<name>My Fabulous Game</name>
	<versionNumber>1.0.0</versionNumber>

	<filename>FileNameOfYourSwfWithoutExtension</filename>
	<copyright>YourCompanyName</copyright>
	<initialWindow>
		<content>[This value will be overwritten by Flash Builder in the output app.xml]</content>
        <fullScreen>true</fullScreen>
        <visible>false</visible>
        <softKeyboardBehavior>none</softKeyboardBehavior>
        <renderMode>cpu</renderMode>
	    <autoOrients>false</autoOrients>
    </initialWindow>
</application>

Replace the red text with your own stuff.

 

The second xml file is called the bar descriptor. It is for App World and the installation process, and is called bar-descriptor.xml. It contains info about the code signing, an icon, permissions etc. A simple bar-descriptor.xml is:

 

<?xml version="1.0" encoding="UTF-8"?>
<qnx>
   <initialWindow>
      <systemChrome>none</systemChrome>
      <transparent>true</transparent>
      <aspectRatio>landscape</aspectRatio>
      <autoOrients>false</autoOrients>
      <renderMode>cpu</renderMode>      
   </initialWindow>

   <!-- your details -->
   <author>your-name-on-certificate</author>
   <authorId>your-id-on-certificate</authorId>

   <category>core.games</category>
   
   <!--  Update each time you package: -->
   <buildId>1</buildId>
   
   <!-- images -->
   <icon>
      <image>icon86x86.png</image>
   </icon>
   <splashscreen>splash-landscape.png</splashscreen>

   <!--  Minimum tablet OS version -->
   <platformVersion>2.1.0.1314</platformVersion>

   <!-- Permissions your app needs -->
   <permission>access_shared</permission>
   <permission>access_internet</permission>
   <permission>play_audio</permission>
   <permission>set_audio_volume</permission>
</qnx>

 Make sure you change at least the red items.

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

Thanks a whole lot! I will try this as soon as possible.

 

I'm a bit curious about the command line to use. Could you perhaps assist me in this too? I mean the line that starts with "blackberry-airpackager.bat", should I put both bar-descriptor.xml and myappname-app.xml in there?

 

I will try to figure it our myself when I get to my workstation but if you could spoonfeed me the answer before I get the chance to try myself I would appreciate it. :smileyhappy:

Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

Got it working just great! Thanks again!

 

I'll try signing the package now. I'll keep this thread 'unsolved' until I've managed to do that, just in case I need some help with that.

Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

Alright I'm almost there. Seems to have signed successfully however there are two things that worries me.

 

Here's what I'm getting from [...]\blackberry-tablet-sdk-3.0.0\lib\adt.jar:

 

=================================================
Info: Package created: myappname-blackberry-new.bar
Info: Bar signed.
Info: Signing successful (RDK)
Info: Bar signed.
Info: Signing successful (AUTHOR)
Info: Sending request: Install
Info: Resetting stale session
Info: Sending request: Install
Info: Action: Install
Info: File size: 19736282
Info: Installing ...
Info: Processing 19736282 bytes
Info: Progress 8%...
Info: Progress 27%...
Info: Progress 46%...
Info: Progress 65%...
Info: Progress 81%...
Info: Progress 100%...
Info: Progress 100%...
actual_dname::com.mydomain.myappname.nYCCgT.i2yV28UwX8Iv6OTlmjjP
actual_id::nYCCgT-i2yV28UwX8Iv6OTlmjjP
actual_version::1.8.1.1
result::success
Info: Sending request: Launch
Info: Action: Launch
Info: Launching com.mydomain.myappname.nYCCgT-i2yV28UwX8Iv6OTlmjjP...
result::Invalid
Info: done

=================================================

 

1) "result::Invalid" doesn't look good, how can I fix this? Looks like the signing and installation was OK but why couldn't it be launched?

 

2) What am I supposed to put as "authorId" in bar-descriptor.xml? I can't find something similar to the required value anywhere except  in the above log ("actual_id"), however I don't know if that is just a ID of the app and not my authorId. Besides, it appears AFTER I've signed the package but I need it before so I can type it inside the xml file.

 

In the documentation on https://developer.blackberry.com/air/documentation/bb10/r_barfile_dtd_ref_authorid.html it says that the authorId is received from the debug token. What debug token? I don't think I have that, where can I get it? I thought a debug token was only required when debugging on a device?

 

 

If I can get help with these two things I think I will be able to sucessfully participate in the Port-A-Thon. :smileyhappy:

Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

Can someone please help me with this last issue I have (in my last post in this thread). I haven't gotten wiser by myself during today and the Port-A-Thon starts very soon now.

 

Bump.

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: The bar-descriptor.xml file (and making the app from command line)

I do not set the authorID, publisheID, initialwindow.content in the app.xml file and never had an issue.

I dont set the authorId, author in the bar-descriptor file either.

Try restarting the device.
Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

I see, I was under the impression that it was required. Thanks! I will try again.

Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

It didn't work when I just restarted the VM, I had to reinstall it. Then it worked:

 

==============================================================

 

[...]\SDK\blackberry-tablet-sdk-3.0.0\lib\adt.jar
Info: Package created: myappname-blackberry-new.bar
Info: Bar signed.
Info: Signing successful (RDK)
Info: Bar signed.
Info: Signing successful (AUTHOR)
Info: Sending request: Install
Info: Resetting stale session
Info: Sending request: Install
Info: Action: Install
Info: File size: 19736216
Info: Installing ...
Info: Processing 19736216 bytes
Info: Progress 5%...
Info: Progress 19%...
Info: Progress 38%...
Info: Progress 59%...
Info: Progress 77%...
Info: Progress 97%...
Info: Progress 100%...
Info: Progress 100%...
actual_dname::com.mydomain.myappname.gYABgF.j1yV18FwO8Xw9OJlnjiU
actual_id::iYBAgF-l1wV26FrO8qw9pInmjjU
actual_version::1.8.3.1
result::success
Info: Sending request: Launch
Info: Action: Launch
Info: Launching com.mydomain.myappname.gYABgF-j1yV18FwO8Xw9OJlnjiU...
result::10440123
Info: done

 

==============================================================

 

Guess it "worked" before too, just that the app couldn't be auto-launched for some reason.

 

Thanks for the help!

 

 

 

Btw, I just noticed something that really got me thinking. I've built my apps working with Android and iPhone, these phones both have a button on the phone that exists (or rather suspends) the app and takes the user back to the home screen. Thanks to this my apps doesn't have a exit button on screen.

 

I just noticed that the BlackBerry 10 doesn't have a physical home button on the phone. Do I have to redesign my apps and add a exit button? Or does BlackBerry exit its apps in a different way, like with a swiping motion?

 

A bit embarrassed about noticing this so late but there's nothing in the media here in Sweden about BlackBerry and I've never seen anyone using one. The thought of the phone not having a physical home button just didn't cross my mind.

 

I really don't want to have to redesign my apps so I hope someone gives me good news about this.

Please use plain text.
Contributor
FunctionCaller
Posts: 28
Registered: ‎01-08-2013
My Device: n/a
My Carrier: n/a

Re: The bar-descriptor.xml file (and making the app from command line)

Just managed to close the app in the simulator using a swipe motion. Phew. So I don't have to redesign my apps.

 

Alright, I will be setting this thread as solved now.

 

Thanks again party people and good luck porting your apps tomorrow!

Please use plain text.