Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you tell programmatically if a Flex App is running in debug mode?

Is it possible to write code in a Flex application that will only be run in a debug build, or when running through the debugger? Does Flex provide a way to actually remove code entirely from release builds, like C-style #defines?

The app is not necessarily running in a web page.

like image 848
MidnightGun Avatar asked Sep 18 '08 09:09

MidnightGun


People also ask

How do you check if APK is debug or release programmatically?

There are different way to check if the application is build using debug or release certificate, but the following way seems best to me. According to the info in Android documentation Signing Your Application, debug key contain following subject distinguished name: "CN=Android Debug,O=Android,C=US".


1 Answers

You can do conditional compilation like this:

CONFIG::debugging {
    // this will be removed if CONFIG::debugging resolves to false at compile time
}

And then add this to the compiler flags:

-define+=CONFIG::debugging,true

for debug builds, and

-define+=CONFIG::debugging,false

for release builds. CONFIG and debugging can be anything, like MY_AWESOME_NAMESPACE and fooBar, it doesn't matter.

Read more here: Using conditional compilation.

like image 140
Theo Avatar answered Sep 24 '22 01:09

Theo