1

I would like to try to create an OpenDocument with my Android app. I've already added the simple-odf-0.8.2-incubating-jar-with-dependencies, but I get an error.

Are there other methods to recommend or tips?

07-10 20:49:11.024 18550-18550/de.***********.printodtfile D/AndroidRuntime: Shutting down VM
07-10 20:49:11.024 18550-18550/de.***********.printodtfile E/AndroidRuntime: FATAL EXCEPTION: main
    Process: de.***********.printodtfile, PID: 18550
    java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLOutputFactory;
        at org.odftoolkit.odfdom.pkg.rdfa.SAXRDFaParser.createInstance(SAXRDFaParser.java:59)
        at org.odftoolkit.odfdom.pkg.OdfFileDom.initialize(OdfFileDom.java:217)
        at org.odftoolkit.odfdom.pkg.manifest.OdfManifestDom.initialize(OdfManifestDom.java:74)
        at org.odftoolkit.odfdom.pkg.OdfFileDom.<init>(OdfFileDom.java:132)
        at org.odftoolkit.odfdom.pkg.manifest.OdfManifestDom.<init>(OdfManifestDom.java:63)
        at org.odftoolkit.odfdom.pkg.OdfFileDom.newFileDom(OdfFileDom.java:189)
        at org.odftoolkit.odfdom.pkg.OdfPackage.parseManifest(OdfPackage.java:1187)
        at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:454)
        at org.odftoolkit.odfdom.pkg.OdfPackage.initializeZip(OdfPackage.java:425)
        at org.odftoolkit.odfdom.pkg.OdfPackage.<init>(OdfPackage.java:285) etc.
Karolis D.
  • 47
  • 4

1 Answers1

0

It looks like that dependency is trying to use a java file in the javax package that isn't included in the Android package index, but it's odd that if it's "with dependencies" that it still doesn't work. From the provided context, I'm assuming you're adding the dependency as a .jar file. Have you tried it as a gradle dependency?

// https://mvnrepository.com/artifact/org.apache.odftoolkit/simple-odf
implementation group: 'org.apache.odftoolkit', name: 'simple-odf', version: '0.8.2-incubating'
Submersed
  • 8,810
  • 2
  • 30
  • 38
  • ok I think it has brought something but now I get something new `Process: de.carolus.printodt, PID: 23777 javax.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxOutputFactory not found` I have found a approach, but the links are broken [link](https://stackoverflow.com/questions/5176028/how-writing-xml-file-usning-xmlstreamwriter-in-android) an idea ? or should I leave with the odt toolkit? – Karolis D. Jul 13 '18 at 09:03
  • Have you tried using 'api' instead of implementation? It's obviously still a dependency error you may need to include other things to fix, but try that instead of 'implementation', do a clean/build and see if the error is the same. – Submersed Jul 13 '18 at 14:41