.NET for Android: ошибка XA1048

Примеры сообщений

error XA1048: 'obj/Debug/net11.0-android/android/AndroidManifest.xml' does not contain an <instrumentation> element. Add an Android.App.Instrumentation subclass to the application, or set the $(AndroidInstrumentation) MSBuild property to the name of one.

Issue

Приложение указало запуск через Android.App.Instrumentation, либо задав $(AndroidUseInstrumentation) или в , но элемент не найден в .

Это отличается от XA1043, о которой сообщается, когда приложение не имеет ни запускаемого <activity>, ни <instrumentation>.

Решение

Объявите инструментирование в приложении:

[Instrumentation (Name = "com.companyname.myapp.MyInstrumentation")]
public class MyInstrumentation : Instrumentation
{
    protected MyInstrumentation (IntPtr handle, JniHandleOwnership ownership)
        : base (handle, ownership) { }
}

Вы также можете присвоить классу имя для явного запуска с помощью $(AndroidInstrumentation) свойство MSBuild или задайте $(AndroidUseInstrumentation) значение false, чтобы вместо этого запустить activity приложения.