Using com.bea.xml.stream package on android

后端 未结 5 548
-上瘾入骨i
-上瘾入骨i 2020-12-04 02:15

For getting Apache POI to work on Android, I need to get Stack to work on Android. Following this question:Using JAXB with Google Android and @Sean Barbeau\'s answer. I succ

5条回答
  •  感动是毒
    2020-12-04 03:02

    After upgrading POI from 3.9 to 3.15 we were getting a:

    javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLEventFactory cannot be created
    

    Besides POI, our build included:

    compile ('com.msopentech.odatajclient:odatajclient-engine:0.9.0')
    

    it turned out that the odatajclient jar included a java.xml.stream.XMLEventFactory file in its META-INF\services, the contain of that file was com.fasterxml.aalto.stax.EventFactoryImpl but the aalto included in odatajclient was old and com.fasterxml.aalto.stax.EventFactoryImpl was finally inheriting from com.msopentech.javax.xml.stream.XMLEventFactory instead of java.xml.stream.XMLEventFactory class.

    At run time POI was using the java.xml.stream.XMLEventFactory, the class loader returned com.fasterxml.aalto.stax.EventFactoryImpl and the cast to java.xml.stream.XMLEventFactory failed.

    The solution was excluding the module that included the old aalto:

    compile ('com.msopentech.odatajclient:odatajclient-engine:0.9.0')
    {
       exclude group: 'com.msopentech.odatajclient', module: 'odatajclient-engine-xml'
    }
    

提交回复
热议问题