Android读取xlsx,解析失败:Ljavax / xml / stream / XMLStreamReader

时间:2019-04-01 16:25:41

标签: java android apache-poi xlsx

我正在尝试从应用程序读取xlsx文件,但出现此错误XMLStreamReader解析失败。尝试创建工作簿时,尝试后第一行出现错误。

/etc/my.cnf
  

org.apache.poi.ooxml.POIXMLException:无法解决以下问题:Ljavax / xml / stream / XMLStreamReader;

这是我的礼物:

private void read(File file) {
        try {
            Workbook workbook = WorkbookFactory.create(file);
            Log.d(TAG, "Workbook has " + workbook.getNumberOfSheets() + " sheets");
        } catch (Exception e) {
            Log.d(TAG, "read: " + e.getMessage());
        }
    }

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-auth:16.2.0'

implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation "org.apache.poi:poi:4.0.1"
implementation "org.apache.poi:poi-ooxml:4.0.1"
}
apply plugin: 'com.google.gms.google-services'

0 个答案:

没有答案