.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 目錄並重建,讓合併後的重新映射檔案重新生成。