Błąd XA1047 platformy .NET dla systemu Android

Przykładowe komunikaty

error XA1047: Required attribute 'from' missing from element 'replace-type'; /path/to/jni-remapping.xml line 3.
error XA1047: Required attribute 'source-type' missing from element 'replace-method'; /path/to/jni-remapping.xml line 7.

Issue

W elemencie w pliku XML przemapowania JNI brakuje wymaganego atrybutu. Elementy <replace-type> i <replace-method> mają wymagane atrybuty, które muszą być obecne.

Wymagane atrybuty dla elementu <replace-type>:

  • from— oryginalna nazwa typu Java (np. com/example/OldClass)
  • to— zastępcza nazwa typu Java (np. com/example/NewClass)

Wymagane atrybuty dla elementu <replace-method>:

  • source-type— typ Java zawierający oryginalną metodę
  • source-method-name — nazwa oryginalnej metody
  • target-type— typ Java zawierający metodę zastępczą
  • target-method-name — nazwa metody zastępczej
  • target-method-instance-to-static — czy zamiana konwertuje metodę wystąpienia na metodę statyczną (true lub false)

Rozwiązanie

Dodaj brakujące wymagane atrybuty do elementu w pliku XML ponownego mapowania interfejsu JNI. Przykład:

<replacements>
  <replace-type from="com/example/OldClass" to="com/example/NewClass" />
  <replace-method
    source-type="com/example/Source"
    source-method-name="instanceMethod"
    target-type="com/example/Target"
    target-method-name="staticMethod"
    target-method-instance-to-static="true" />
</replacements>