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
Posts: 579
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

Getting simple BB10 AIR apps to compile via the command line

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 = 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.html

Compiling with the command line:

https://developer.blackberry.com/air/beta/documentation/create_your_first_application_cmd_ms_2010847...

This 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!

 

Here's my blog post on this matter:

http://playbookdev.net/document.pl?mode=Display&DocumentID=953

Developer
Posts: 1,082
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Getting simple BB10 AIR apps to compile via the command line

Interesting.  Your example compiled for me just fine.  The only difference I readily see is that I'm using Java 6.

Developer
Posts: 1,082
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Getting simple BB10 AIR apps to compile via the command line

BTW, what else is in your %PATH%?   Are you 100% sure you are executing the amxmlc in the BB10 SDK and not the one in a different SDK that happens to be earlier in your %PATH%?

Developer
Posts: 1,082
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Getting simple BB10 AIR apps to compile via the command line

Also, just curious why you are constructing two instances of the same class and assigning them to the same variable:

 

            var alert:AlertDialog = new AlertDialog();
            alert = new AlertDialog();

 

Developer
Posts: 1,082
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Getting simple BB10 AIR apps to compile via the command line

[ Edited ]

The %PATH% issue above is why my commandline compile flow scripts call a common one-line script to set my SDK path in my own environment variable (I just call it "BBSDKPATH")  in one and only one place in the flow.   I never depend on whatever happens to have accumulated in the Windows %PATH% variable in the command shell I happen to be running in to compile with the correct SDK.

 

Code snippet:

 

call SetBBSDKPathEnvVar.bat
set BBSDKBINPATH=%BBSDKPATH%\bin

 

where the SetBBSDKPathEnvVar.bat is the one line script I mentioned.

Developer
Posts: 579
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: Getting simple BB10 AIR apps to compile via the command line

Well that is very strange. Do you have any other SDK directories in your PATH, or any SDK files in the same directory as your *.as files?

 

Here's my PATH:

 

C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Pr
ogram Files (x86)\jZip;C:\Program Files (x86)\QuickTime\QTSystem\;E:\Program Files (x86)\Microsoft Visual Studio\Common\Tools\WinNT;E:\Program Files (x86)\Micro
soft Visual Studio\Common\MSDev98\Bin;E:\Program Files (x86)\Microsoft Visual Studio\Common\Tools;E:\Program Files (x86)\Microsoft Visual Studio\VC98\bin;E:\Pro
gram Files (x86)\Java\jre6\bin\;E:\Program Files\Research In Motion\blackberry-tablet-sdk-3.0.0\bin

 

The only SDK-related directory is:

 

E:\Program Files\Research In Motion\blackberry-tablet-sdk-3.0.0\bin

 

Very strange that yours compiles and mine doesn't.

Developer
Posts: 1,082
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Getting simple BB10 AIR apps to compile via the command line

I provided the explicit path to the amxmlc command when I compiled it.  The contents of my PATH variable could not have influenced the result.

Developer
Posts: 579
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: Getting simple BB10 AIR apps to compile via the command line

Developer
Posts: 1,082
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Getting simple BB10 AIR apps to compile via the command line

[ Edited ]

Java 6 vs. 7 is the only difference I'm readily seeing here then.  I would not expect that to make a difference but who knows.  One thing you could try just as an experiment is to give the compiler the explicit path to the lib that contains that component (use the library path option).  Your error message seems to indicate the compiler can't find that component.

Developer
Posts: 579
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: Getting simple BB10 AIR apps to compile via the command line

Same behavior with Java 6.

 

I've tried:

 

amxmlc Example.as -compiler.include-libraries "E:\Program Files\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs\qnx\ane\QNXSkins.ane" -compiler.include-libraries "E:\Program Files\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs\qnx\qnxui.swc"

 

... without any luck, although I don't see any difinitive way to know what libraries are or aren't required. This goes back to my request of RIM to clarify this so that it isn't a guessing game for devs.

 

However, if it "just works" for you, perhaps that explains why there isn't any explanation anywhere for what libraries are required, etc?  Am I the only one that can reproduce this problem?