Skip to content

Android build fails with XAAMM0000 (android:exported missing on MainActivity) when the Android TV feature is enabled #23989

Closed
unoplatform/uno.templates
#2199

Description

@khaskoul

Current behavior 🐛

A new unoapp created with the Android TV feature fails on its first Android build:

obj\Debug\net10.0-android\AndroidManifest.xml(14,5): java.exe error AMM0000:
	android:exported needs to be explicitly specified for element <activity#crc643a741d82e4a5fc42.MainActivity>.
	Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported`
	when the corresponding component has an intent filter defined.

Xamarin.Android.Common.targets(1695,3): error XAAMM0000: ...AndroidManifest.xml:14:5-20:16 Error: [same]

The managed assembly compiles fine; the failure is in the manifest merge / packaging step, so it is not a C# error.

Root cause

Platforms/Android/MainActivity.Android.cs (template: content/unoapp/MyExtensionsApp.1/Platforms/Android/MainActivity.Android.cs) declares an explicit [IntentFilter] under #if useAndroidTV, but [Activity] never sets Exported:

[Activity(
    MainLauncher = true,
    ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges,
    WindowSoftInputMode = SoftInput.AdjustNothing | SoftInput.StateHidden
)]              // <-- no Exported
#if useAndroidTV
[IntentFilter(
    new[] { Android.Content.Intent.ActionMain },
    Categories = new[] {
        Android.Content.Intent.CategoryLauncher,
        Android.Content.Intent.CategoryLeanbackLauncher
    })]
#endif

The .NET Android manifest generator emits android:exported="true" automatically only when it synthesizes the launcher intent-filter itself from MainLauncher = true. Once an explicit [IntentFilter] is present it emits that filter verbatim and leaves exported to [Activity] — which doesn't set it — so the attribute is absent entirely and the manifest merger rejects it at targetSdkVersion >= 31.

Verified by deleting only the [IntentFilter] block from an otherwise untouched copy of the generated project: build succeeded, and the generated manifest contained android:exported="true".

Generated manifest, non-TV (passes):

<activity android:configChanges="..." android:name="crc643a741d82e4a5fc42.MainActivity" android:exported="true">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

Generated manifest, Android TV (fails — no android:exported):

<activity android:configChanges="..." android:name="crc643a741d82e4a5fc42.MainActivity">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
  </intent-filter>
</activity>

Expected behavior 🎯

The generated project builds for Android without modification.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. dotnet new unoapp -n UnoApp6 --includeAndroidTV true (or tick Android TV in the wizard / VS Code extension) with Android as a target platform.
    • Equivalent on an existing app: add AndroidTV to <UnoFeatures> in the csproj and add the leanback [IntentFilter] to MainActivity.
  2. dotnet build UnoApp6.slnx (TargetFramework net10.0-android).
  3. Build fails with the two errors above.

Workaround 🛠️

No response

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

No response

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk 6.7.0-dev.162
Uno.Templates 6.7.0-dev.158
TargetFramework net10.0-android (targetSdkVersion 36, minSdkVersion 21)
Microsoft.Android.Sdk.Windows 36.1.43
OS Windows 11 Pro 26200

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

No response

Activity

  1. added theissue type on Aug 6, 2026
  2. added
    triage/untriaged
    on Aug 6, 2026
  3. khaskoul commented on Aug 12, 2026

    @khaskoul
    Author

    Fix verified with:
    Templates/SDK: 6.7.10
    Platform(s): Desktop
    VS VSIX: 6.7.5
    IDE: VS 18.4.6
    OS: Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

triage/untriaged

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions