在 build.gradle 中使用 XML 到 java 对象转换器依赖项构建错误以进行改造
Build errors with XML to java object converter dependency in build.gradle for retrofit
我正在尝试通过以下 https://futurestud.io/blog/retrofit-how-to-integrate-xml-converter/
将 XML 集成到 Java 对象转换器进行改造
当我向 build.gradle 添加依赖项时出现构建错误。
这是我在 build.gradle 中添加的内容。
编译 ('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
所以我试过了
compile ('com.squareup.retrofit:converter-simplexml:1.9.0') {
exclude group: 'xpp3', module: 'xpp3'
}
错误报告:
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
我试过 gradle clean,构建 clean 一切但没有用。如果你有任何想法,请帮助我。
我可以解决它。我必须排除以下传递依赖项: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'
}
谢谢!
更新:retrofit2 的相同修复
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta3'){
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
它也适用于 2.0.0-beta3。
// Retrofit XML convertidor
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta3'){
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
我正在尝试通过以下 https://futurestud.io/blog/retrofit-how-to-integrate-xml-converter/
将 XML 集成到 Java 对象转换器进行改造当我向 build.gradle 添加依赖项时出现构建错误。
这是我在 build.gradle 中添加的内容。 编译 ('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
所以我试过了
compile ('com.squareup.retrofit:converter-simplexml:1.9.0') {
exclude group: 'xpp3', module: 'xpp3'
}
错误报告:
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
我试过 gradle clean,构建 clean 一切但没有用。如果你有任何想法,请帮助我。
我可以解决它。我必须排除以下传递依赖项: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'
}
谢谢!
更新:retrofit2 的相同修复
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta3'){
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
它也适用于 2.0.0-beta3。
// Retrofit XML convertidor
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta3'){
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}