Page 1 of 1

Shading settings for Android docx4j

PostPosted: Thu May 19, 2022 2:33 pm
by krist.pregracke
Hello,

I'm trying to convert to HTML on android, but I'm getting the error
Code: Select all
java.lang.IllegalAccessError: Method 'java.lang.Class org.apache.xalan.extensions.ExtensionHandler.getClassForName(java.lang.String)' is inaccessible to class 'org.apache.xalan.extensions.ExtensionHandlerJavaPackage' (declaration of 'org.apache.xalan.extensions.ExtensionHandlerJavaPackage' appears in /data/app/~~ZVtmRtuHfRuZhq2toABrQA==/com.example.myapplication-ahlQie1BfblXFLdcJxSU1Q==/base.apk!classes3.dex)


I'm using the jar from https://github.com/plutext/Docx4j4Android4

I'm thinking I'll need to reshade the docx4j jar to mark that class as public, as it seems that it use used as such.

I was wondering if Mr. Plutext could point me towards his shading settings to make my life easier.

Re: Shading settings for Android docx4j

PostPosted: Fri May 20, 2022 8:03 am
by jason
Seems this IllegalAccessError is tracked as https://github.com/plutext/Docx4j4Android4/issues/5

In answer to your question, https://github.com/plutext/Docx4j4Andro ... gradle#L67

Shade plugin in 6.1.1 (commented out) is at https://github.com/plutext/docx4j/blob/ ... m.xml#L244 but to start, try uncommenting that to build your shaded jar.

That's using Xalan 2.7.2.

docx4j for Android does need some love; it'd to be good to upgrade it to parity with current Java releases. Until I get time to look at that, I can't be much help here I'm afraid.