0

私の Android アプリは、XML を使用して SPring Boot REST サービスと通信します。

Android で JAXB を利用するのは簡単ではありません (軽量でもありません)。そこで、jackson-dataformat-xml の使用について読みました。(ネストされた) オブジェクトのリストを操作します。

私の質問: これは、XML メッセージを (非) マーシャリングするための推奨される方法ですか? そうでない場合、Android に適したオプションは何ですか? もしそうなら、以下の問題を解決するのを手伝ってくれませんか?

JUnit テストは簡単にパスします。コンパイルは次を使用して問題ありません。

packagingOptions {
    pickFirst  'META-INF/license.txt'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/MANIFEST.MF'
    exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
    exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
}

dependencies { 
    .... 
    compile 'com.fasterxml.jackson.core:jackson-core:2.1.2'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.1.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.1.2'
    compile( 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.3.0')
}

アプリを実行することはできません。次のようなあらゆる種類のエラーが発生します。

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.codehaus.stax2.XMLStreamLocation2$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

編集: それまでの間、Simple XML が優れた評価を得ていることがわかりました。

4

1 に答える 1

0

現在、単純な XML を使用しています。それはうまくいっています。

于 2017-02-24T07:50:03.793 に答える