Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Documentation/docs-mobile/messages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
+ [XA4215](xa4215.md): The Java type \`com.contoso.library1.Class1\` is generated by more than one managed type. Please change the \[Register\] attribute so that the same Java type is not emitted.
+ [XA4216](xa4216.md): The deployment target '19' is not supported (the minimum is '21'). Please increase the $(SupportedOSPlatformVersion) property value in your project file.
+ XA4217: Cannot override Kotlin-generated method '{method}' because it is not a valid Java method name. This method can only be overridden from Kotlin.
+ [XA4217](xa4217.md): Architecture '{arch}' has Java types which have no counterparts in template architecture '{templateArch}': {types}
+ [XA4218](xa4218.md): Unable to find //manifest/application/uses-library at path: {path}
+ XA4219: Cannot find binding generator for language {language} or {defaultLanguage}.
+ XA4220: Partial class item '{file}' does not have an associated binding for layout '{layout}'.
Expand All @@ -193,6 +194,7 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
+ XA4224: Malformed full class name '{name}'. Missing class name.
+ XA4225: Widget '{widget}' in layout '{layout}' has multiple instances with different types. The property type will be set to: {type}
+ XA4226: Resource item '{file}' does not have the required metadata item '{metadataName}'.
+ [XA4227](xa4227.md): Architecture '{arch}' doesn't match all marshal methods in architecture '{templateArch}'. Please see detailed MSBuild logs for more information.
+ XA4228: Unable to find specified //activity-alias/@android:targetActivity: '{targetActivity}'
+ XA4229: Unrecognized \`TransformFile\` root element: {element}.
+ XA4230: Error parsing XML: {exception}
Expand All @@ -214,6 +216,7 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
+ [XA4235](xa4249.md): Maven artifact specification '{artifact}' is invalid. The correct format is 'group_id:artifact_id:version'.
+ [XA4250](xa4250.md): Manifest-referenced type '{type}' was not found in any scanned assembly. It may be a framework type.
+ [XA4252](xa4252.md): Insecure HTTP Maven repository URL '{url}' is not allowed. Use an HTTPS URL, or set AllowInsecureHttp="true" metadata on the item to override this check.
+ [XA4253](xa4253.md): Generated Java callable wrapper code changed: '{path}'
+ XA4300: Native library '{library}' will not be bundled because it has an unsupported ABI.
+ [XA4301](xa4301.md): Apk already contains the item `xxx`.
+ [XA4302](xa4302.md): Unhandled exception merging \`AndroidManifest.xml\`: {ex}
Expand Down
29 changes: 29 additions & 0 deletions Documentation/docs-mobile/messages/xa4217.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: .NET for Android error XA4217
description: XA4217 error code
ms.date: 05/20/2026
f1_keywords:
- "XA4217"
---

# .NET for Android error XA4217

## Example messages

```
error XA4217: Architecture 'x86' has Java types which have no counterparts in template architecture 'arm64-v8a': MyNamespace.MyType
```

## Issue

When building for multiple Android architectures, each architecture must
produce the same set of Java callable wrapper types. This error means
one architecture generated Java types that do not exist in the template
(first) architecture.

## Solution

Ensure that all target architectures reference the same set of managed
types that derive from `Java.Lang.Object`. If architecture-specific
code is needed, use runtime checks rather than conditional compilation
that adds or removes Java-bound types per architecture.
29 changes: 29 additions & 0 deletions Documentation/docs-mobile/messages/xa4227.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: .NET for Android error XA4227
description: XA4227 error code
ms.date: 05/20/2026
f1_keywords:
- "XA4227"
---

# .NET for Android error XA4227

## Example messages

```
error XA4227: Architecture 'x86' doesn't match all marshal methods in architecture 'arm64-v8a'. Please see detailed MSBuild logs for more information.
```

## Issue

When building for multiple Android architectures, the marshal methods
generated for each architecture must be consistent. This error means
one architecture has marshal methods that do not match those of the
template (first) architecture.

## Solution

Ensure that all target architectures reference the same set of managed
types and methods. Enable detailed MSBuild logging (`-v:diag`) to see
exactly which marshal methods differ, then adjust the project so that
all architectures produce the same set of marshal methods.
28 changes: 28 additions & 0 deletions Documentation/docs-mobile/messages/xa4253.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: .NET for Android error XA4253
description: XA4253 error code
ms.date: 05/20/2026
f1_keywords:
- "XA4253"
---

# .NET for Android error XA4253

## Example messages

```
error XA4253: Generated Java callable wrapper code changed: 'obj/Release/android/src/mono/MonoRuntimeProvider.java'
```

## Issue

The generated Java callable wrapper (JCW) source file was unexpectedly
modified during the build. This usually indicates that an incremental
build detected a change in the generated output that should not have
occurred.

## Solution

Perform a clean build of your project (`dotnet clean` followed by
`dotnet build`) to ensure all generated files are up to date. If the
error persists, please file a bug report with a reproduction project.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,12 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
<comment>The following are literal names and should not be translated: AndroidManifest.xml, //uses-sdk/@android:targetSdkVersion , API-{1}
{0} - The target SDK version number
{1} - The API version number</comment>
</data>
<data name="XA4217" xml:space="preserve">
<value>Architecture '{0}' has Java types which have no counterparts in template architecture '{1}': {2}</value>
<comment>{0} - The target architecture name
{1} - The template architecture name
{2} - Comma-separated list of Java type names that have no counterparts</comment>
</data>
<data name="XA4218" xml:space="preserve">
<value>Unable to find //manifest/application/uses-library at path: {0}</value>
Expand Down Expand Up @@ -701,6 +707,11 @@ In this mesage, the term "layout" means an Android UI layout.
<value>Resource item '{0}' does not have the required metadata item '{1}'.</value>
<comment>{0} - The name of the Android layout resource file
{1} - The name of the metadata item</comment>
</data>
<data name="XA4227" xml:space="preserve">
<value>Architecture '{0}' doesn't match all marshal methods in architecture '{1}'. Please see detailed MSBuild logs for more information.</value>
<comment>{0} - The target architecture name
{1} - The template architecture name</comment>
</data>
<data name="XA4228" xml:space="preserve">
<value>Unable to find specified //activity-alias/@android:targetActivity: '{0}'</value>
Expand Down Expand Up @@ -1112,6 +1123,10 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS
<comment>The following are literal names and should not be translated: HTTP, HTTPS, Maven, AllowInsecureHttp
{0} - The insecure HTTP URL</comment>
</data>
<data name="XA4253" xml:space="preserve">
<value>Generated Java callable wrapper code changed: '{0}'</value>
<comment>{0} - The path to the generated Java callable wrapper file</comment>
</data>
<data name="XA0142" xml:space="preserve">
<value>Command '{0}' failed.\n{1}</value>
<comment>'{0}' is a failed command name (potentially with path) followed by all the arguments passed to it. {1} is the combined output on the standard error and standard output streams.</comment>
Expand Down
11 changes: 4 additions & 7 deletions src/Xamarin.Android.Build.Tasks/Utilities/JCWGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public bool GenerateCode (CallableWrapperType generator, TypeDefinition type, st
var changed = Files.CopyIfStreamChanged (writer.BaseStream, path);

if (changed) {
log.LogError ($"Generated Java callable wrapper code changed: '{path}' ");
log.LogCodedError ("XA4253", Properties.Resources.XA4253, path);
} else {
log.LogMessage ($"Java callable wrapper code already up to date: '{path}'");
}
Expand Down Expand Up @@ -188,12 +188,9 @@ static void EnsureIdenticalCollections (TaskLoggingHelper logger, NativeCodeGenS
}

if (!typesSet.SetEquals (templateSet)) {
logger.LogError ($"Architecture '{state.TargetArch}' has Java types which have no counterparts in template architecture '{templateState.TargetArch}':");

typesSet.ExceptWith (templateSet);

foreach (var type in typesSet)
logger.LogError ($" {type}");
var typesList = string.Join (", ", typesSet.OrderBy (t => t, StringComparer.Ordinal));
logger.LogCodedError ("XA4217", Properties.Resources.XA4217, state.TargetArch, templateState.TargetArch, typesList);
}
}

Expand Down Expand Up @@ -268,7 +265,7 @@ static void EnsureClassifiersMatch (TaskLoggingHelper logger, NativeCodeGenState
return;
}

logger.LogError ($"Architecture '{state.TargetArch}' doesn't match all marshal methods in architecture '{templateState.TargetArch}'. Please see detailed MSBuild logs for more information.");
logger.LogCodedError ("XA4227", Properties.Resources.XA4227, state.TargetArch, templateState.TargetArch);
}

static bool CheckWhetherMethodsMatch (TaskLoggingHelper logger, MarshalMethodEntry templateMethod, AndroidTargetArch templateArch, MarshalMethodEntry method, AndroidTargetArch arch)
Expand Down