Android용 .NET 오류 XA1042

예제 메시지

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

Issue

dotnet run는 자신의 <instrumentation> 요소를 통해 실행 가능한 <activity>가 없는 앱을 실행하지만, android:name에서 찾은 AndroidManifest.xml 요소에는 <instrumentation> 속성이 없으므로 실행할 클래스가 없습니다.

해결 방법

요소에 <instrumentation> 이름을 지정합니다. 직접 작성한 AndroidManifest.xml에 선언되어 있는 경우 다음 속성을 추가합니다:

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

요소가 Android.App.Instrumentation 하위 클래스에서 생성된 경우 [Instrumentation] 특성에서 Name 속성을 설정합니다.

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

또는 다음을 설정합니다. $(AndroidInstrumentation) 시작할 클래스 이름에 대한 MSBuild 속성입니다.