Page 1 of 1

Android docx4j example doesn't work

PostPosted: Fri Jun 22, 2012 10:25 pm
by zac
I tried to test docx to conversion on android using the following example/project:

But everytime I try to run the project it keeps launching it and eventually the whole eclipse freezes. I created a new project (AndroidDocxToHtml2) and just copy pasted all clasess and libraries etc and even commented out all code in try-catch block in AndroidDocxToHtmlActivity. It was still keep launching the whole time but at least displayed the following message:
Dx warning: Ignoring InnerClasses attributeDx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.log4j.chainsaw.ControlPanel$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.

after few minutes eclipse showed the following window:

Unable to execute-dex: GC-overhead limit exceeded. GC Overhead limit exceeded

I tested it on android device SGS2 with 4.0.3 and as well using emulator. And I'm really getting desperate stucking with this conversion task for a week :/

Re: Android docx4j example doesn't work

PostPosted: Fri Jun 22, 2012 10:52 pm
by jason
As per the readme at the same URL:

To run this Eclipse project, you'll probably need to increase your heap space in eclipse.ini (symptom is 'you get Unable to execute dex: Java heap space').

I used:

In Eclipse, Windows > Preferences > General > Show Heap Status gives you an entry on the bottom row which is useful.

It works for me on an Android 4 tablet, someone else on Android 3, and someone else again on Android 2.3.3 (using Samsung Galaxy S2)

hope this helps...

Re: Android docx4j example doesn't work

PostPosted: Wed Jun 27, 2012 3:47 am
by zac
Thx, that helped!

However openning sample document is extremely slow (processing took ~25sec on my SGS2 with ICS 4.0.3). Is is typical or maybe I'm the only one experiencing this? Otherwise is there any way to speed up this - e.g. I don't need to display/process and images - do you know where is the bottleneck?
Reducing distribution package would be great as well - if I don't need to display image I guess I can remove awt.jar?

Re: Android docx4j example doesn't work

PostPosted: Wed Jun 27, 2012 9:04 am
by jason
zac wrote: extremely slow (processing took ~25sec on my SGS2 with ICS 4.0.3)

Yes, the first document will be slow. That is JAXB context initialisation, coupled with a wimpy processor (even Tegra 3 based system is much slower in my experience than i5/i7).

There are 2 ways around this:

1. remove some of the namespaces from the context (eg VML, DrawingML), though this is removing functionality; you could even make a simplified wml.xsd, and feed it through XJC to support only part of WordML.

2. better, alter the JAXB source code to load namespaces only as needed