我使用Xerces换Android平台: https://code.google.com/p/xerces-for-android/
如果我的源代码复制到一个简单的测试项目(Java项目,而不是Android项目),我没有任何问题,运行我的XML验证测试。
当我做一个罐子从源文件,然后使用,在我的类路径而不是源,我得到NoClassDefFoundError
尽管文件存在于罐子。
下面是错误信息:
java.lang.ExceptionInInitializerError
at mf.org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
at mf.org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
at mf.org.apache.xerces.impl.xs.XMLSchemaLoader.reset(Unknown Source)
at mf.org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at mf.org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at mf.org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
at mf.javax.xml.validation.SchemaFactory.newSchema(Unknown Source)
at xml.MFXMLUtil.validate(MFXMLUtil.java:33)
at xml.MFXMLTester.main(MFXMLTester.java:8)
Caused by: java.lang.RuntimeException: internal error
at mf.org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(Unknown Source)
at mf.org.apache.xerces.impl.dv.xs.BaseSchemaDVFactory.createBuiltInTypes(Unknown Source)
at mf.org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.createBuiltInTypes(Unknown Source)
at mf.org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.<clinit>(Unknown Source)
... 9 more
下面是我的ant脚本,使罐:
<project name="XercesForAndroid" default="dist" basedir=".">
<description>
Builds jar for Xerces-For-Android
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="clean, init" description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac verbose="true" target="1.6" srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the .jar file -->
<jar jarfile="${dist}/lib/Xerces-For-Android.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
类文件在罐子里存在。 我需要做什么特别的表现,还是我失去了一些东西明显?