Android的 - docx4j建设问题 [英] Android - docx4j build issue

查看:1201
本文介绍了Android的 - docx4j建设问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序。在我需要显示DOCX,XLSX我的应用程序中的文件。我有搜索在互联网上发现的 docx4j 将转换DOCX,XLSX文件,HTML(或)PDF格式。所以,我打算从显示的HTML返回 docx4j 在web视图。

I am developing an android application. In which I need to show the docx, xlsx files inside my application. I have searched in the internet and found docx4j will convert docx, xlsx files to html (or) pdf. So that I am planning to show the html return from the docx4j in the webview.

所以,我已经从 github上下载源,并试图运行示例。给出的链接以及我所做的更改在eclipse.ini文件。

So that I have downloaded the source from github and tried to run the sample. I made changes in eclipse.ini file as given in the link as well.

不过,我不能执行应用程序。当我运行的应用程序,我得到了以下异常。

But, I couldn't execute the application. When I run the app, I am getting the following exception.

[2014-11-24 17:19:34 - AndroidDocxToHtml-master] Conversion to Dalvik format failed with error 1

详细的日志:

[2014-11-24 17:19:34 - AndroidDocxToHtml-master] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.xml.serializer.SecuritySupport12$8) 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.
[2014-11-24 17:19:34 - AndroidDocxToHtml-master] 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.GeneratedMethodAccessor20.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:188)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
    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:1143)
    at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
    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 008c at offset 000002a6
...while parsing cst 0005 at offset 00000018
...while parsing org/apache/xml/serializer/utils/SerializerMessages_ru.class

[2014-11-24 17:19:34 - AndroidDocxToHtml-master] Dx 1 error; aborting
[2014-11-24 17:19:34 - AndroidDocxToHtml-master] Conversion to Dalvik format failed with error 1

我加了库只有一次在应用程序中。

I have added the libs only one time in the app.

可能是什么问题。谁能帮我解决这个问题?

What may be the issue. Can anyone help me to fix this?

推荐答案

最后,我找到了解决办法。我没有添加所有他们在 github上给出什么样的罐子。所以,我得到了上面的异常。

Finally I found the solution. I did add all the jars what they given in the github. So that I got the above exception.

现在我删除了从工作区串行 - 2.7.1.jar,然后构建应用程序。我可以转换的docx没有构建问题HTML。这是工作的罚款了。

Now I removed the "serializer-2.7.1.jar" from the workspace and then build the app. I can convert the docx to html without build issue. It is working fine now.

这篇关于Android的 - docx4j建设问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆