2015-04-26 42 views
1

我试图在Android Studio中为项目添加spring-context。我在的Xerces带来所以Spring可以正确地分析我的背景文件,但导致这个错误:Xerces + Gradle = preDexDebug错误

Execution failed for task ':app:preDexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

gradlew assembleDebug说,问题是:

trouble processing "javax/xml/XMLConstants.class"

,然后添加一个长期的,目空一切的演讲关于为什么编译核心库是一件坏事。好的,那我该如何解决这个问题?

一两件事没有工作,试图排除违规的模块:

compile ('xerces:xercesImpl:2.11.0') { 
    exclude module: 'xml-apis' 
} 

这导致更广泛的编译错误。

没有工作,另一件事是following the instructions for this Gradle JarJar plugin,这导致:

Could not find property 'preBuild' on task set.

我即将准备放弃,只是从头开始写我自己的解析器。有没有办法做到这一点?

+0

您使用的是32位系统还是64位? –

回答

0

Xerces扩展了核心库javax,这导致了Android中的这个problem

您可以通过使用诸如JarJar这样的工具重新包装所需的类来克服此问题。这已在Xerces-for-Android中完成,其中包“mf”位于“常规”Xerces软件包的上方。