Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
720 views
in Technique[技术] by (71.8m points)

apache flex - Can I build a debug version of an Adobe AIR application?

I'm trying to debug an issue on a clients machine. The problem is that the problem is a runtime error with very little clue as to where it is. It is an intermittent problem. I know ADL allows me to run the application in a debug mode. The problem is that to tell the user to download and manage the ADL invokation is going to be very difficult. It would be a lot easier if I could just give the end user one install/executable to install and run and then send me the trace of the issue. So what I'm looking for is easy steps for the client to be able to run the AIR app in debug mode. Downloading ADL and finding the install location of the app is going to be difficult to manage remotely with the end user.

Update: You have to make sure you are working with AIR 3.5 and Flash 11.5 and also include the following flag "-swf-version=18" in additional compiler settings. You then have to catch the global error as mentioned in the answer and it will show you the location of the error. No line numbers of course. Just routine names. Thanks a milion to Lee for the awsome answer.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

not a direct answer but if you publish for AIR3.5 (or 3.6 beta), you can get some debug info:

add a listener for uncaught RTEs to top level of your app:

this.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, globalErrorHandler);

and grab debug info from error in listener:

function globalErrorHandler(event:UncaughtErrorEvent):void
{
    var message:String;
    //check for runtime error
    if (event.error is Error)
        message = (event.error as Error).getStackTrace();
    //handle other errors
    else if (event.error is ErrorEvent)
        message = (event.error as ErrorEvent).text;
    else
        message = event.error.toString();
    //do something with message (eg display it in textfield)
    myTextfield.text = message;
}

getStackTrace will return a stack trace even for release AIR apps (as long as you use AIR3.5 or above).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...