Can I build a debug version of an Adobe AIR applic

2019-01-18 01:15发布

问题:

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.

回答1:

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, errorHandler);

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).



回答2:

Without the SDK Tools; I don't think it is possible to run an aIR app in debug mode. But, here are a few alternatives to consider:

  • The client must have some idea what is going on to cause the error, right? Can you give them a special build with Alert Boxes or logging or something to help isolate the error to a line of code?
  • Can you listen for the uncaughtException event? The event will give you the full stack trace ( Error.getStackTrace() ); which you could then log--possibly with other information. Then you just have to tell your client to "Go here" and "send me this file." Or even display the info in some Alert and have the user copy and paste it into an email to you. More info on uncaughtException here and here


回答3:

check my post. Maybe it helps you to get stack trace with line numbers in a AIR release build. How can I get stacktrace for Adobe AIR global runtime errors in non-debug mode?

I use it in 2 big projects right now and it works very well.

Greetings