How to Edit Run Configuration Options

Answered

Hello, I am creating an Android run configuration programatically as part of a plugin. I have been able to create an empty configuration and load its content from an xml file, but I would like to edit its options (such as the options in the workspace.xml below) in the java code and not in the xml.

<configuration name="app-launch" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="app" />
<option name="DEPLOY" value="false" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="MODE" value="default_activity" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="DEBUGGER_TYPE" value="Java" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
</Profilers>
<option name="ACTIVITY_CLASS" value="" />
<method v="2" />
</configuration>


I have not been able to find the class that holds all these options and provides methods to edit them. Below is my code for creating a run configuration. Any advice would be appreciated, thank you.

RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project);

RunnerAndConfigurationSettingsImpl launchAppConfigSettings = new RunnerAndConfigurationSettingsImpl(manager);

InputStream resource = this.getClass().getClassLoader().getResourceAsStream("runconfigurations/run-configuration.xml");
Element data = JDOMUtil.load(resource);
launchAppConfigSettings.readExternal(data, false);

manager.addConfiguration(launchAppConfigSettings);

 

0
1 comment

Please see SDK docs for overview http://www.jetbrains.org/intellij/sdk/docs/basics/run_configurations.html

See com.android.tools.idea.run.AndroidRunConfigurationBase and implementations for Android run configs

0

Please sign in to leave a comment.