Edit

.NET for Android error XA1047

Example messages

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

A required attribute is missing from an element in the JNI remapping XML file. The <replace-type> and <replace-method> elements each have required attributes that must be present.

Required attributes for <replace-type>:

  • from — the original Java type name (e.g. com/example/OldClass)
  • to — the replacement Java type name (e.g. com/example/NewClass)

Required attributes for <replace-method>:

  • source-type — the Java type containing the original method
  • source-method-name — the name of the original method
  • target-type — the Java type containing the replacement method
  • target-method-name — the name of the replacement method
  • target-method-instance-to-static — whether the replacement converts an instance method to a static method (true or false)

Solution

Add the missing required attributes to the element in your JNI remapping XML file. For example:

<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>