.NET for Android 错误 XA1045

示例消息

error XA1045: Input file `/path/to/jni-remapping.xml` does not start with `<replacements/>`.

Issue

错误中提到的生成的 JNI 重映射 XML 文件没有预期的 <replacements/> 根元素。 构建过程在生成原生 JNI 重映射代码之前,会先合并其内部重映射输入来创建此文件。

解决方案

检查错误中报告的文件路径和构建输出,以确定是哪个工作负载或包重映射输入生成了无效的 XML。 每个重新映射输入都必须以 <replacements> 根元素开头。 例如:

<replacements>
  <replace-type from="com/example/Old" to="com/example/New" />
</replacements>

更正或更新输入的源包后,删除项目的 obj 目录并重新生成,以便重新生成合并的重新映射文件。