diff --git a/tools-local/tasks/mobile.tasks/AndroidAppBuilder/ApkBuilder.cs b/tools-local/tasks/mobile.tasks/AndroidAppBuilder/ApkBuilder.cs index e76e66db3692a..5640c51113306 100644 --- a/tools-local/tasks/mobile.tasks/AndroidAppBuilder/ApkBuilder.cs +++ b/tools-local/tasks/mobile.tasks/AndroidAppBuilder/ApkBuilder.cs @@ -286,7 +286,15 @@ public void ReplaceFileInApk(string file) string aapt = Path.Combine(buildToolsFolder, "aapt"); string apksigner = Path.Combine(buildToolsFolder, "apksigner"); - string apkPath = Directory.GetFiles(Path.Combine(OutputDir, "bin"), "*.apk").First(); + string apkPath = ""; + if (string.IsNullOrEmpty(ProjectName)) + apkPath = Directory.GetFiles(Path.Combine(OutputDir, "bin"), "*.apk").First(); + else + apkPath = Path.Combine(OutputDir, "bin", $"{apkPath}.apk"); + + if (!File.Exists(apkPath)) + throw new Exception($"{apkPath} was not found"); + Utils.RunProcess(aapt, $"remove -v bin/{Path.GetFileName(apkPath)} {file}", workingDir: OutputDir); Utils.RunProcess(aapt, $"add -v bin/{Path.GetFileName(apkPath)} {file}", workingDir: OutputDir);