Android + Proguard + Apache POI

前端 未结 2 651
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 19:38

Someone was able to get the Apache POI library to work after obfuscation. I read a lot of information, tried different methods, but still get the error:

a.a.         


        
2条回答
  •  天涯浪人
    2021-01-18 20:32

    you can use the latest poi 3.17 without any significant modification to the original library for excel xlsx format and run this successfully on android provided you have eliminate all those duplicate classes bundle in the xmlbeans-2.6.0.jar and not forgetting these two required stax and stax-api jar library too . If you do run proguard , please be extra careful not to obfuscate relevant important classes such as com.bea.xml.** and the rest in the xmlbeans and some schema required by poi. ProGuard Rules Example as shown below. If the Api is less than 20 or below and in certain phone models , the full drawing and spreadsheet package in the ooxml-schemas-1.3.jar is somehow required to avoid class not found error.

    jar link

    -keep class org.** { *; }
    -keep class com.bea.xml.stream.**{*;}
    -keep class org.apache.xmlbeans.** { *; }
    -keep class com.microsoft.** { *; }
    -keep class org.openxmlformats.**{*;}``
    -keep class com.apache.poi.** { *; }
    -keep class schemaorg_apache_xmlbeans.** {*;}
    

    link to post

提交回复
热议问题