Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xalan.jar error when build in android project

Tags:

java

android

jar

I use xalan.jar in my android project. When i build project -> error (i have select in properties/java build path/Order and Export/xalan.jar). (if not select xalan.jar in "Order and Export/xalan.jar" project build ok.)

Detail error in Console:

[2013-12-30 15:20:28 - SignAndroid] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.xml.serializer.CharInfo$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
[2013-12-30 15:20:28 - SignAndroid] Dx 
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad utf-8 byte 9a at offset 00000002
    at com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:374)
    at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:262)
    at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:294)
    at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)
    at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
    at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.processClass(Main.java:665)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:596)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:753)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:593)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
    at org.eclipse.core.internal.resources.Project.build(Project.java:124)
    at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1116)
    at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.IllegalArgumentException: bad utf-8 byte 9a at offset 00000002
    at com.android.dx.rop.cst.CstString.throwBadUtf8(CstString.java:171)
    at com.android.dx.rop.cst.CstString.utf8BytesToString(CstString.java:143)
    at com.android.dx.rop.cst.CstString.<init>(CstString.java:200)
    at com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:371)
    ... 42 more
...while parsing cst 004f at offset 00000205
...while parsing cst 0005 at offset 00000018
...while parsing org/apache/xml/serializer/utils/SerializerMessages_ru.class

[2013-12-30 15:20:28 - SignAndroid] Dx 1 error; aborting
[2013-12-30 15:20:28 - SignAndroid] Conversion to Dalvik format failed with error 1
like image 472
user3090190 Avatar asked Nov 01 '22 08:11

user3090190


1 Answers

I know it very late but if you havent got any fix, here is the solution which is working for me. I was using xalan 2.7.1 jar and i upgraded it to 2.7.2 which can be downloaded from here:

http://psg.mtu.edu/pub/apache/xalan/xalan-j/binaries/

Also, replace your "serializer.jar" with the serializer jar which comes with xalan-2.7.2. After that just do clean your project and run it.

like image 190
mudit Avatar answered Nov 10 '22 00:11

mudit