diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs b/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs index e2e5b9349b1..9195f5e36e6 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs @@ -4,6 +4,7 @@ using System.IO; using Xamarin.Android.Tools; using Microsoft.Android.Build.Tasks; +using System.Text; namespace Xamarin.Android.Tasks { @@ -43,10 +44,27 @@ public class D8 : JavaToolTask public string ExtraArguments { get; set; } protected override string GenerateCommandLineCommands () + { + var cmd = new CommandLineBuilder (); + + if (!string.IsNullOrEmpty (JavaOptions)) { + cmd.AppendSwitch (JavaOptions); + } + + cmd.AppendSwitchIfNotNull ("-Xmx", JavaMaximumHeapSize); + cmd.AppendSwitchIfNotNull ("-classpath ", JarPath); + cmd.AppendSwitch (MainClass); + + return cmd.ToString (); + } + + protected override string GenerateResponseFileCommands () { return GetCommandLineBuilder ().ToString (); } + protected override Encoding ResponseFileEncoding => Encoding.UTF8; + protected virtual string MainClass => "com.android.tools.r8.D8"; protected int MinSdkVersion { get; set; } @@ -55,13 +73,6 @@ protected virtual CommandLineBuilder GetCommandLineBuilder () { var cmd = new CommandLineBuilder (); - if (!string.IsNullOrEmpty (JavaOptions)) { - cmd.AppendSwitch (JavaOptions); - } - cmd.AppendSwitchIfNotNull ("-Xmx", JavaMaximumHeapSize); - cmd.AppendSwitchIfNotNull ("-classpath ", JarPath); - cmd.AppendSwitch (MainClass); - if (!string.IsNullOrEmpty (ExtraArguments)) cmd.AppendSwitch (ExtraArguments); // it should contain "--dex". if (Debug)