How to have variations in AndroidManifest.android-xml for debug/release builds?

I have been looking at widget development with Oxygene and found that to debug my widget I need an activity to which the debugger is able to attach.

This is easily done with an empty activity configured as my launch activity, but when I build my widget application for release I obviously don’t want this activity included.

Is there a way to specify variations in the AndroidManifest.android-xml for different builds, i.e. debug vs release ?

If there is no current mechanism specifically for this, could I suggest an idea…

As I understand it, the AndroidManifest.android-xml undergoes some form of processing by Oxygene as part of the build process. As part of that, perhaps some XML could be introduced in an “oxygene” namespace which would be used to influence the resulting XML during build processing, so for example any element decorated with an oxygene:build attribute would be included only in builds of the specified type:

<activity oxygene:build=“debug” … >

Possible values would be “debug” or “release”. This approach could be extended to any of the various XML resources in an Android project, possibly subject to some new “Build Action”, though it should be possible to trigger the processing (and removal) of the oxygene directives simply by identifying a specific oxygene namespace declaration in the XML.

Maybe. Just throwing ideas out there.

Thanks for the idea, the correspondent feature request is registered as #64311.

Meanwhile, it won’t do any harm to the app if you have the activity defined in the manifest that you won’t use. However, you can place the code, that starts this activity in #{$IFDEF DEBUG} block. For release build, the code inside block won’t be included in target apk.

Thanks Anton, though the problem is that the “DebugActivity” needs to be configured as the “Home” activity so that it will be launched automatically for the debugger to attach to. i.e. if I understand what you mean correctly, there isn’t any runtime code that can be $IFDEF’d out to prevent it launching.

Commenting in/out the Activity XML works for now though. :slight_smile: