Edit

.NET for Android error XA1042

Example messages

error XA1042: The <instrumentation> element in 'obj/Debug/net11.0-android/android/AndroidManifest.xml' is missing the android:name attribute.

Issue

dotnet run launches an app without a launchable <activity> through its <instrumentation> element, but the <instrumentation> element found in AndroidManifest.xml has no android:name attribute, so there is no class to launch.

Solution

Give the <instrumentation> element a name. If it is declared in your hand written AndroidManifest.xml, add the attribute:

<instrumentation android:name="com.companyname.myapp.MyInstrumentation" />

If the element is generated from an Android.App.Instrumentation subclass, set the Name property on the [Instrumentation] attribute:

[Instrumentation (Name = "com.companyname.myapp.MyInstrumentation")]
public class MyInstrumentation : Instrumentation
{
}

Alternatively, set the $(AndroidInstrumentation) MSBuild property to the class name to launch.