Android: Editing INI Parameters from the Command Line

Article written by Ryan B.

Right now INI parameters are only read from the DefaultEngine.ini. In UEDeployAndroid.cs for distribution builds, these values are read from the ini and written into the gradle.properties before Gradle is called to package either the AAB or APK.

Here is the code that reads these:

string KeyAlias, KeyStore, KeyStorePassword, KeyPassword;
Ini.GetString("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "KeyStore", out KeyStore);
Ini.GetString("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "KeyAlias", out KeyAlias);
Ini.GetString("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "KeyStorePassword", out KeyStorePassword);
Ini.GetString("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "KeyPassword", out KeyPassword);

You could get these from command line with:

 class UEDeployAndroid : UEBuildDeploy, IAndroidDeploy
 {
     [CommandLine("-keystorepassword")]
     private string ArgKeyStorePassword = null;
     ....
 }

Then override the ini if an argument is provided:

     if (ArgKeyStorePassword != null)
     {
         KeyStorePassword = ArgKeyStorePassword;
     }