dotnet/maui · error · Exception

UI Test application path not specified.

Error message

UI Test application path not specified.

What it means

Thrown by ExecutePrepareUITests (Android) when GetTestApplications returns no application path for the given app/device/config/tfm inputs. The test app binary (.apk) could not be located, so UI test preparation cannot proceed.

Source

Thrown at eng/devices/android.cake:244

			// CopyFile(testApp, new DirectoryPath(resultsDir).CombineWithFilePath(new FilePath(testApp).GetFilename()));
		}

		HandleTestResults(resultsDir, testsFailed, false);
	}

	Information("Testing completed.");
}

void ExecutePrepareUITests(string project, string app, string appPackageName, string device, string resultsDir, string binDir, string config, string tfm, string rid, string ver, string toolPath, string instrumentation, bool headless)
{
	string platform = "android";
	Information("Preparing UI Tests...");

	var testApp = GetTestApplications(app, device, config, tfm, "").FirstOrDefault();

	if (string.IsNullOrEmpty(testApp))
	{
		throw new Exception("UI Test application path not specified.");
	}
	if (string.IsNullOrEmpty(appPackageName))
	{
		var appFile = new FilePath(testApp);
		appFile = appFile.GetFilenameWithoutExtension();
		appPackageName = appFile.FullPath.Replace("-Signed", "");
	}
	if (string.IsNullOrEmpty(instrumentation))
	{
		instrumentation = appPackageName + ".TestInstrumentation";
	}

	Information("Test App: {0}", testApp);
	Information("Test App Package Name: {0}", appPackageName);
	Information("Test Results Directory: {0}", resultsDir);
	Information($"Testing Device: {device}");
	Information($"Testing App Project: {app}");
	Information($"Testing App: {testApp}");

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Build the TestCases.Android app first with the same configuration and TFM that the test step expects.
  2. Set ANDROID_TEST_APP (or pass --app=<path>) to the directory containing the -Signed.apk, or build it so GetTestApplications can discover it.
  3. Verify config, tfm, and rid arguments match between the build and the UI-test invocation.
Defensive patterns

Strategy: validation

Validate before calling

var apps = GetTestApplications(app, device, config, tfm, "");
if (!apps.Any())
    throw new Exception($"No Android test app found for app='{app}', config='{config}', tfm='{tfm}'. Build the app first.");
var testApp = apps.First();

Prevention

When it happens

Trigger: GetTestApplications(app, device, config, tfm, "").FirstOrDefault() returns null/empty — i.e. no built .apk matches the supplied app path, configuration, TFM, or rid arguments/environment variables.

Common situations: The TestCases.Android app was never built before running the UI test target; the ANDROID_TEST_APP / app argument points at a stale or wrong directory; config/tfm mismatch between the build step and the test step (e.g. built for android31.0 but querying android34.0).

Related errors


AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13). Data as JSON: /api/errors/42807ab4266a7068. Report an issue: GitHub.