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

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.

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

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

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

Related

Errors showing in Qt application - how to not display them in Release

A Qt project gives a number of errors - that I do not actually consider errors I think:
Some examples:
Fontconfig error: "/etc/fonts/conf.d/65-khmer.conf", line 32: out of memory
// ?
QGraphicsItem::ungrabMouse: not a mouse grabber
// i think happens when the mouse grab didn't quite happen, user moved too fast...
A few others
the first one seems it has an answer here https://askubuntu.com/questions/421891/fontconfig-error-out-of-memory
So I cannot fix it through software, the user must fix it... since it is system dependent...
Even built in release, these errors will still show up on command line... Since they do not cause the application to behave abnormally, I don't think the user should see them.
How can I build/deploy the application without these errors showing ?
ideally of course there would be no errors in a deployed application, but I don't know what I can do about those types of errors...
It is possible to redirect a stream (in this case stderr) after the fact using
freopen("/dev/null", "w", stderr);
Just place this in your main before any other code runs and you should be good. Keep in mind that this might need more work on Windows.
If the error message is posted through the Qt Message infrastructure (qDebug etc.) you can set a new message handler through the function qInstallMsgHandler.

BB 10 App Crashing in device,but working good in simulator

I have developed an BB 10 app, It is working well in the simulator.The same app is not working in the device.I want to know , why it is crashing in device.
Is there any way to know the reason for crashing after installing in the device, so that i can fix it.
I have created a log file in the Device Documents
Is there any signal / listener OR try and catch mechanism, to write that exception into the log file?
my bar-descriptor.xml is like this, Please find.
<!-- Request permission to execute native code. Required for native applications. -->
<permission system="true">run_native</permission>
<permission>read_device_identifying_information</permission>
<permission>access_pimdomain_messages</permission>
<permission>access_internet</permission>
<permission system="true">_sys_use_consumer_push</permission>
<permission>access_sms_mms</permission>
<permission>post_notification</permission>
<permission>access_shared</permission>
<permission>bbm_connect</permission>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
Please help,
Thanks!!!
You haven't given much to go on but here are some things to check right off the bat:
If the application isn't signed, and you don't have a debug token, or the token has expired or development mode has expired on the device the application will exit from the splash screen.
If you aren't requesting all necessary permissions in you app-descriptor.xml file your application may be getting unexpected results that cause the crash.
If you have a higher OS version on the simulator than the device, you may be using QML that isn't recognized by the device QML compiler which will cause a crash when the returned QML document is null. This is usually logged to the console.
If it isn't one of those, use the IDE run the application on the device and see if there is anything useful logged to the console. If not, set the IDE into debug mode to run the program under the debugger on the device. It will halt execution where the application is aborting. This may be deep in a system library but you may be able to step up the call stack to your code to find out the location of the problem.

c# windows app OK in debug mode, faulty in release mode

I've written a c# windows app, that performs some DB intensive operations. (MySQL connector v6).
When running the project in Debug mode, everything works fine. However, when I run the prject in release mode, it sometimes quits operation midway - with no error message, nothing in the event logs etc.
What would be the best way to debug release mode - when everything works in debug mode?
Thanks for any help,
Bob
You can create a log file and have the application write lines to it with information of your choice, similarly to how the console may be used for debug purposes in a windows form application. You can write values of certain variables to this file, or even just write distinct phrases in select places of the code that will help you detect where the program is in execution when it fails.
Bobby is correct in asking about Application Event Log. If it is bombing on a .NET error, it will likely be logged.
If that doesn't give you anything, wrap the entire app in a try/catch block. On your exception handling, log the error (application log, file, etc...). Make sure when you log it to capture the call stack.
I've got exactly the same problem - application running in debug mode and fail in release. Try the following:
Wrap everything in Program.cs in try{}..catch{} block and it will show a reason
I don't know why but my application failed on Program.SetCompatibleTextRenderingDefault() function with message that it should be called before any instances on IWin32Window or something like that
It is very strange errors for me cuz i didn't have any code before this function. But you can try - maybe it will show something useful for you

EQATEC Profiler - The remote server returned an error: (404) Not Found

I'm trying to use EQATEC Profiler to profile my ASP.Net app. I followed the instructions listed here. It worked the first time, but every since then, when I run my app, I don't get a "Profiled app started" message. Then when I click on the "Take snapshot" button, I get the following:
"Taking snapshot ...failed: The remote server returned an error: (404) Not Found."
Why can't it find my app?
If a profiled app encounters errors it will log these to the profiler.log file. By default you will find this in C:\Windows\Temp\EQATECProfilerLogs. Try to see if it holds some clues. You can also try to enable "Full logging" in the app options, which will at least output something to the log.
A profiled app is actually the "server" when talking to the profiler; it is the profiler that connects to the app, not the other way around. In your case it seems that the old app has stopped listening (otherwise the profiler's attempt to connect would simply be served by the old app), but the new app has not (could not?) started listening.
It seems strange, though, so my best suggestion is to examine the log-file. It will e.g. show if the app could not start its control-server and if so, why not.
1) Try rebuilding (in Equatec) your application. Make sure "enable runtime control" is enabled in the application options when you build.
1a) Try changing the port being used for runtime control.
2) Run your application through Equatec
3) Check if you have anything funny for firewall settings or similar. Some firewalls treat Equatec communication as traffic to be blocked.
4. If all else fails, just close your application normally. Even if taking snapshots fails, you can still see the profile once your application is closed.
Guess I should provide an update on this. The error was resolved once I downloaded the latest version.

Flash stop "actionscript error" dialog box from appearing

I need to disable flash from showing these error messages when an error occurs. I am completely aware of the error I'm receiving, and it does not cause my application from working correctly. I simply need to disable these messages. Is there a setting in flash or a flex compiler command or something? Thanks, David.
There are a lot of things you can do with your mm.cfg file (google it's usage)
For instance if you put:
SuppressDebuggerExceptionDialogs=1
In there it will prevent the debugger version of flash from popping up error windows in your browser.
No, unfortunately there's no such thing. Though, the errors will not be displayed to users that have the release version of the flash player installed, and not the debugger one.
There's a very hot feature request for the flash player but the implementation seems far from happening: Ability to intercept system error dialogs. There are a lot of comments some heated, some sarcastic but Adobe seems to still ignore this issue.
UPDATE
The feature has since been implemented. Last comment says:
This has been fixed with Flash player 10.1
http://labs.adobe.com/technologies/flashplayer10/features.html
Global error handler The new global error handler enables developers
to write a single handler to process all runtime errors that were not
part of a try/catch statement. Improve application reliability and
user experience by catching and handling unexpected runtime errors and
present custom error messages. When using the global error handler in
a SWF running in the debug player, error pop-ups will not be shown.

Resources