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
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Useful Tip: Package Images Via Command Line

[ Edited ]

Hey guys and gals,

 

Ok so for the last 12 hours i've been fighting with the packaging command line. i was overly spoiled by Burrito and all of its glory. So here's the story:

 

First, i thought i would be clever and let Burrito package everything up for me (despite seeing that FB4 cannot do so). I assumed Burrito could do the package by Exporting it and then i can sign via command line. Not the case. It exports with in dev mode (i know im stubborn - i have to experience the issue before i accept it hah).

 

So i would keep getting the "still in dev mode" error from the signer.

 

I did the whole opening it up and manually making changes to the manifest file. i know its not the same, but i tried anyway and well failed. so then packaging via Flash Builder Burrito was off the table.

 

So then i looked at the command line. My biggest peeve about the command line was how i was going to package all the images i have in my project. I've read everywhere use the -C. Its posted everywhere, but no one ever confirmed it. and i tried every variation, googled and googled. Even the airpackager gave me this:

 

 

<files> - file or directory to include in a package, also include options:
   -C <dir> <file_or_dir> - use <dir> as a root direcory, all files which are following can be relative to this directory and used with tail paths
   -e <file> <path> - save file with the provided <path> in the package

 

So I thought for sure it had to be something with the -C.

 

 

Everytime i try to use it using the airpackager command line i would either get no images packaged or i would get a "folder or file not found" error from the packager.

 

So then i finally found a page online:

 

http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128cdca935b-8000.html

 

And then mid way through the page, i found my holy grail:

 

 

adt –package -storetype pkcs12 -keystore cert.p12 myApp.air myApp.xml myApp.swf images

 

 

so what does that mean? we dont have to do anything special to package our images. all we have to do is call the subdirectory, and it will package everything underneath it. pretty cool right?

 

so this is what i did, every step to sign. (i havent finished up my application yet, but i created a test application and signed it).

 

First I ran a debug via Flash Builder Burrito. Nothing special just ran it just like any other time. So what that did for me was create the .SWF, -app.xml, and put all the things i needed into the bin-debug directory. I got ride of the .bar file, its garbage.

 


 

 

UPDATE: Acenet has brought to my attention an additional recommended step. The way i orginally had the steps laid out, it created "psuedo" non-developmental mode package. However, what he pointed out was your package was still inflated with debug data. I further went ahead and confirmed what he said. By not taking his tip and not adding the "-debug=false" to the compiler settings, flash builder popped out a file that was almost two times of what it should be.

 

so what does this mean? we should do what he says hah. the simple way i found was to go to your project in the package explorer in the left pane of the Flash Builder Burrito program. Right click on your project go to Properties.

 

Then find the option in the left pane that says "ActionScript Compiler". There you will find a field where you can put in compiler parameters. There should already be this:

 

 

-locale en_US

 

 

We are going to be adding "-debug=false" so the final text in that box should be:

 

 

-locale en_US -debug=false

 

 

Now hit apply, and OK. So now when you continue to do what this thread says, flash builder burrito should pop up a message saying the SWF file does not contain any debug data and you should rebuild your project. Its going to ask if you still want to continue debugging, and you should click on yes. This will then create and dump all the files you need to re-package using the following steps. you will stil have to change the contents of the -app.xml file to remove the instance of "debug" as stated in the steps below. The only difference is that you now have a lighter application.

 

Also worth noting that i did follow the below steps after this new step was added and everything packaged and signed just as expected - minus the size of the file which is great. Again thanks Acenet!

 

 


 

 

after it did that i opened up the -app.xml. I looked for every place where it mentioned the dreaded "debug". i got rid of it (only in two places):

 

 

	<id>com.domain.MyApp.debug</id>

 

 

and

 

 

	<name>MyApp-debug</name>

 

 

Then I had to change the version number in the -app.xml. Burrito by default makes it 0.0.0:

 

 

	<versionNumber>0.0.0</versionNumber>

 

 

I changed it to 1.0.0. Then everything was set for packaging from the bin-debug directory. I no longer need the help of Burrito from this point. I had the following structure:

 

 

bin-debug/
  |
  |--assets/
  | |
  | |--images/
  |   |
  |   |--buttons/
  |     |-- bunch of images
  |   |--core/
  |     |-- bunch of images
  |   |
  |   |--themes
  |     |-- bunch of images
  |   |
  |   |-- bunch of images
  |
  |-- blackberry-tablet.xml
  |-- MyApp-app.xml
  |-- MyApp.swf
  |-- my_icon.png

 

 

So most of it is in my root src, and could be packaged without a problem but when it came to the assets folder, i didnt know how to do it (-C wasn't working).

 

Using the website i found, i went with a whim and did this:

 

 

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-airpackager -package MyApp.bar MyApp-app.xml MyApp.swf blackberry-tablet.xml my_icon.png assets

and wouldnt u know it? it packaged everything. after all the "stuff" i went through, the images never got packaged, and then simply adding the "assets" to the end of the command line did the trick.

 

Results:

 

 

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-airpackager -package MyApp.bar MyApp-app.xml MyApp.swf blackberry-tablet.xml my_icon.png assets

Using icon: /Users/JRab/dev/air/MyApp/bin-debug/my_icon.png
The bar manifest file is valid.
Package created: MyApp.bar

 

 

I keep telling everyone, everyones been tripped up and misses the smallest details. this case is no different.

 

so what to do after that? It's signing time. so we have our newly created bar, non-debug, manifest is good to go too. no errors. *phew*

 

As per the instructions here:

 

 

http://docs.blackberry.com/en/developers/deliverables/23959/Signing_your_application_1422721_11.jsp

 

I did the following to request a signature:

 

 

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-signer -verbose -cskpass "mypassword123" -keystore "/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/output_file.p12" -storepass "mypassword123" MyApp.bar RDK

 

 

Then i got the following out put from the terminal:

 

 

Developer Certificate TBS =
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 

(... a lot of this ...)

sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 
sd dj 90 92 26 25 ed 3b fa 23 f9 d3 df 92 7b 29 

 updating: META-INF/MANIFEST.MF
   adding: META-INF/RDK.SF
   adding: META-INF/RDK.EC
  signing: air/MyApp-app.xml
  signing: air/assets/.DS_Store
  signing: air/assets/images/side_pane_selected_blue.png
  signing: air/assets/images/side_pane_selected_orange.png
  signing: air/assets/images/side_pane_selected_yellow.png
  signing: air/blackberry-tablet.xml
  signing: air/my_icon.png
  signing: air/MyApp.swf
bar signed.

 

 

Another hurdle passed. next came to sign the bar:

 

 

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-signer -keystore "/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/output_file.p12" -storepass "mypassword123" MyApp.bar author

 

 

and finally got this output:

 

 

bar signed.

 

 

and then for good measure? i installed the app via command line onto the simulator to make sure everything was in place:

 

 

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-deploy -installApp -launchApp -package MyApp.bar -device 172.16.176.133 -password "mypassword123"

 

 

Output from terminal:

 

 

Sending Install and Launch request...
Info: Action: Install and Launch
Info: File size: 255790
Info: Installing com.domain.MyApp.gYABgJL-mfZU_pFFVhv6hQCr8kU...
actual_dname::com.domain.MyApp.gYABgJL.mfZU_pFFVhv6hQCr8kU
actual_id::gYABgJL-mfZU_pFFVhv6hQCr8kU
actual_version::1.0.0.0
result::success
Info: Launching com.domain.MyApp.gYABgJL.mfZU_pFFVhv6hQCr8kU...
result::1048618
Info: done

 

 

and then it ran. beautifully. and contrary to what i've been preaching, they do NOT send a confirmation email when you sign an app. *takes foot out of mouth*

 

so there you have it folks. done live (as i typed i did all this to confirm). Signing works (after a dozen failed attempts hah).

 

and to help you out, i've attached all the files i've used in this including the project. i always liked good reference material.

 

Also worth noting, i kept all my passwords the same as my pin. that was just my way of doing it. you can always do your own thing but i dont know how that will turn out. also dont use the quotes, i just used them to emphasize the password.

 

I would have done the run through of registration but i didnt have the common sense to document it. so i cant do it over again.

 

best of luck to everyone and their apps! time to finish mine!

 

P.S. If i missed something please let me know ASAP!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
New Developer
russ_mtc
Posts: 5
Registered: ‎11-08-2010
My Device: Storm 2
My Carrier: Verizon

Re: Useful Tip: Package Images Via Command Line

Thanks for the tip! That will come in handy down the road, for sure.

Please use plain text.
Developer
Acenet
Posts: 249
Registered: ‎11-02-2010
My Device: PlayBook
My Carrier: -

Re: Useful Tip: Package Images Via Command Line

Hello JRab,

 good detailed process.

 

About the "debug" part, I think removing "debug" from the config file is not enough - well, it was not enough for my app, as the result was a large .bar file.

So I had to specify in FB compiler options the flag "-debug=false":

I had then a lighter .bar file, with no "debug" anywhere (specifically in the manifest file)

Otherwise I use bbairpackager with same options as you do.

 

 

 

JC
Please use plain text.
Developer
tags07
Posts: 386
Registered: ‎12-12-2010
My Device: BB Style
My Carrier: Sprint

Re: Useful Tip: Package Images Via Command Line

Great tip, JRab..Now let me try this on the Webworks app...

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Useful Tip: Package Images Via Command Line

hey guys,

 

thanks for the great feedbacks!

 

@acenet: i tried adding -debug=false to the packager command line, but everytime i do so, it spits out an error stating its not a valid parameter:

 

 

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-airpackager -package MyApp.bar MyApp.xml MyApp.swf blackberry-tablet.xml my_icon.png assets -debug=false

Error: Unknown option: -debug=false

"/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-airpackager -debug=false -package MyApp.bar MyApp.xml MyApp.swf blackberry-tablet.xml my_icon.png assets

Error: Unknown option: -debug=false

Jagar-MAC:bin-debug Jagar$ "/Applications/Adobe Flash Builder Burrito/sdks/blackberry-tablet-sdk-0.9.3/bin/"blackberry-airpackager -package MyApp.bar MyApp.xml MyApp.swf blackberry-tablet.xml my_icon.png assets -debug false

Error: Unknown option: -debug

 

so my next guess would be that option needs to be set in the mxmlc command line step? i let burrito do that step for me. i'll try to add that parameter to burrito and see if there is a difference. i'll keep you posted!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Useful Tip: Package Images Via Command Line

[ Edited ]

it would be a GIFT if the folks at RIM would release a simple drag-and-drop AIR app that would sign our .bar files.

 

i was thinking about writing one myself, but last year i attempted to create an android packager with disasterous results.  AIR's Native Process API makes it possible cross-platform, but there were a lot of unforeseen pitfalls.


PlayBook Applications:
Drop Swatch
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: Useful Tip: Package Images Via Command Line

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Useful Tip: Package Images Via Command Line

@acenet: I set the -debug=false in the compiler settings and just like you said, the size of the applicaiton shrunk incredibly! I edited my original post reflecting what you said. The only "but" is that my -app.xml still had the "debug" instances that i had to manually remove. aside from that, everything you said was spot on! Thanks!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
Developer
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: Useful Tip: Package Images Via Command Line

JRab! Your instructions were great and I followed through the steps easily! Thanks for posting an additional guide. These forums are great because of the efforts of users such as you.

 

Kudos! :smileyhappy:

 

BTW: My app went from 4.5MB to 1.25MB with the -debug=false

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Useful Tip: Package Images Via Command Line

@JohnP: very cool! glad it helped you out! yeah these forums are full of data - the more data the more we have to work with haha. thanks for the confirmation and yeah its cahrazy how much inflated the project bar file gets when you are debugging (another thanks to Acenet for pointing the -debug=false out!)

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.