Android용 .NET 오류 XA1047

예제 메시지

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

JNI 다시 매핑 XML 파일의 요소에서 필수 특성이 없습니다. <replace-type> 및 <replace-method> 요소는 각각 반드시 포함되어야 하는 필수 속성을 가지고 있습니다.

<replace-type>에 필요한 속성:

  • from- 원래 Java 형식 이름(예: com/example/OldClass)
  • to— 대체 Java 형식 이름(예: com/example/NewClass)

<replace-method>에 필요한 속성:

  • source-type— 원래 메서드를 포함하는 Java 형식
  • source-method-name — 원래 메서드의 이름
  • target-type— 대체 메서드를 포함하는 Java 형식
  • target-method-name — 대체 방법의 이름
  • target-method-instance-to-static — 대체 항목이 인스턴스 메서드를 정적 메서드로 변환하는지 여부(true 또는 false)

해결 방법

JNI 다시 매핑 XML 파일의 요소에 누락된 필수 특성을 추가합니다. 다음은 그 예입니다.

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