ссылка на пост

о смог заставить библиотеку Apache POI работать после запутывания. Я прочитал много информации, пробовал разные методы, но все равно получаю ошибку:

a.a.b.a: Provider com.bea.xml.stream.EventFactory not found
org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(Unknown Source)
at org.apache.poi.openxml4j.opc.OPCPackage.init(Unknown Source)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(Unknown Source)
at org.apache.poi.openxml4j.opc.Package.<init>(Unknown Source)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(Unknown Source)
at org.apache.poi.openxml4j.opc.OPCPackage.create(Unknown Source)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(Unknown Source)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)

Я добавил файлы jars в папку libs: poi-ooxml-schemas-3.12-20150511-a.jar и poi-3.12-android-a.jar.

Мой proguard-rules.pro:

-dontwarn org.apache.**
-dontwarn org.openxmlformats.**
-dontwarn schemasMicrosoftComVml.**
-dontwarn org.w3.x2000.**
-dontwarn org.etsi.uri.**
-dontwarn com.microsoft.schemas.**
-dontwarn schemasMicrosoftComOfficeOffice.**
-dontwarn schemasMicrosoftComOfficeExcel.**
-dontwarn com.google.common.**

-keeppackagenames org.jsoup.nodes
-keepattributes *Annotation*, EnclosingMethod,Signature, JavascriptInterface
-keep class com.google.common.**

#Parcel
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
-keep class org.parceler.Parceler$Parcels

#Apache poi
-keep public class org.apache.poi.** {*;}
-keep class com.fasterxml.aalto.** {*;}
-keep class org.apache.xmlbeans.** {*;}
-keep class org.openxmlformats.schemas.** {*;}
-keep class com.microsoft.schemas.** {*;}

#BUTTERKNIFE
-keep public class * implements butterknife.internal.ViewBinder { public <init>(); }

# Prevent obfuscation of types which use ButterKnife annotations since the simple name
# is used to reflectively look up the generated ViewBinder.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.test.apachepoicentic"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        debug{
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
        }
    }

    lintOptions {
        // There are restricted packages used in some of POI code, e.g. java.awt or javax.imageio
        // I could not exclude these in the
        abortOnError false
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:multidex:1.0.1'
    //compile group: 'org.apache.poi', name: 'poi', version: '3.17-beta1'
    //compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17-beta1'
    testCompile 'junit:junit:4.12'
    compile files('libs/poishadow-all.jar')
    //compile 'org.apache.poi:poi:3.17-beta1'
    //compile 'org.apache.poi:poi-ooxml:3.17-beta1'
    //compile files('libs/poi-3.12-android-a.jar')
    //compile files('libs/poi-ooxml-schemas-3.12-20150511-a.jar')
   /* compile files('libs/poi-ooxml-schemas-3.12-20150511-a.jar') {
        exclude group: 'stax', module: 'stax-api'
    }*/
}

Ответы на вопрос(2)

Ваш ответ на вопрос