【问题标题】:jackson dependency build error with stax-api jar使用 stax-api jar 的杰克逊依赖项构建错误
【发布时间】:2014-11-29 09:51:56
【问题描述】:

我制作了一个与 Google App Engine 通信的 Android 应用,为此我使用了Restlet API。

我在 build.gradle 中的依赖:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.google.android.gms:play-services:5.0.89'
    compile 'com.android.support:support-v4:20.0.0'
    compile 'org.restlet.android:org.restlet:2.2.2'
    compile 'org.restlet.android:org.restlet.ext.jackson:2.2.2'
}

这是尝试构建项目后的跟踪:

Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
E:\Applications\Android Studio\sdk\build-tools\19.1.0\dx.bat --dex 
--output [projectPath]\app\build\intermediates\pre-dexed\debug\stax-api-1.0-2-[...].jar
[windowsAccountPath]\.gradle\caches\modules-2\files-2.1\javax.xml.stream\stax-api\1.0-2\[...]\stax-api-1.0-2.jar

Error Code: 1
Output:
trouble processing "javax/xml/stream/EventFilter.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse).

在没有compile 'org.restlet.android:org.restlet.ext.jackson:2.2.2' 的情况下构建工作,但显然我的代码中有错误..

我不知道stax API是什么,我什至不会使用它!

有人知道如何正确导入和使用Restlet Android API 吗?

【问题讨论】:

  • 此依赖项随 com.fasterxml.jackson.xml.jar 一起提供。我已经更新了 Restlet 框架的 Android 版本,以便使用 Jackson 删除 XML 的透明序列化/反序列化。该修复将成为未来 2.3.0 和 2.2.4 版本的一部分。

标签: android dependencies jackson restlet stax


【解决方案1】:

您可以通过排除导致问题的依赖项来避免此问题:-

compile('com.fasterxml:jackson-xml-databind:0.6.2'){
    exclude module: 'stax'
    exclude module: 'stax-api'
    exclude module: 'xpp3'
}

如果你一定需要这些,使用 jar jar 重命名类路径以使事情正常工作。

https://github.com/CUTR-at-USF/SiriRestClient/wiki

https://code.google.com/p/jarjar/

【讨论】:

    猜你喜欢
    • 2015-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 2016-08-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多