建立一个与XML错误java对象转换器依赖于build.gradle的改造建立一个、转换器、对象、错误

2023-09-07 12:03:58 作者:酷到被通缉

我想通过以下方法的 https://futurestud.io/blog/retrofit-how-to-integrate-xml-converter/

我收到编译错误,当我说依赖于我的build.gradle。

I am getting build errors when I added dependency to my build.gradle.

这是我在我的build.gradle已经增加。 编译(com.squareup.retrofit:转炉的SimpleXML:1.9.0')

This is what I've added in my build.gradle. compile ('com.squareup.retrofit:converter-simplexml:1.9.0')

错误报告:

Information:Gradle tasks [:app:assembleDebug]
Warning:Dependency xpp3:xpp3:1.1.3.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency xpp3:xpp3:1.1.3.3 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages

所以,我想这个

SO I TRIED this

compile ('com.squareup.retrofit:converter-simplexml:1.9.0') {
exclude group: 'xpp3', module: 'xpp3'
}

这个错误报告:

Error report with this:

trouble processing "javax/xml/stream/events/StartElement.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
....
...
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

我试过摇篮干净,打造干净的一切,但没有用。帮助我,如果你已经什么想法就可以了。

I tried gradle clean, build clean everything but of no use. Help me if you've any idea on it.

推荐答案

我可以解决这个问题。我不得不排除以下传递依赖:STAX:STAX-API,STAX:STAX

I could resolve it. I had to exclude the following transitive dependencies: stax:stax-api, stax:stax.

compile ('com.squareup.retrofit:converter-simplexml:1.9.0') {
    exclude group: 'xpp3', module: 'xpp3'
    exclude group: 'stax', module: 'stax-api'
    exclude group: 'stax', module: 'stax'
}

谢谢!