Пытаюсь подключить библиотеки poi.apache.org, это последние 5 библиотек, указанные в build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.hand.measurements"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'org.apache.commons:commons-lang3:3.6'
implementation 'junit:junit:4.12'
implementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':classification')
implementation files('libs/commons-io-2.6.jar')
implementation files('libs/poi-3.17.jar')
implementation files('libs/poi-ooxml-3.17.jar')
implementation files('libs/poi-ooxml-schemas-3.17.jar')
implementation files('libs/commons-collections4-4.1.jar')
implementation files('libs/xmlbeans-2.6.0.jar')
}
Во время build или компиляции проекта возникают следующие ошибки:
Information:Gradle tasks [build]
Error:Program type already present: org.apache.xmlbeans.xml.stream.XMLName
Error:Program type already present: org.apache.xmlbeans.xml.stream.Location
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\base_android\AndroidStudioProjects\Measurements\app\libs\xmlbeans-2.6.0.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Error:com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Error:com.android.tools.r8.utils.AbortException: Error: Program type already present: org.apache.xmlbeans.xml.stream.XMLName
Information:BUILD FAILED in 6m 39s
Information:6 errors
Information:0 warnings
Information:See complete output in console
Попытки добавить проект версии библиотеки xmlbeans 3.0.1 и 3.0.2 приводили к тому, что проект всё-таки компилировался, но во время выполнения строки
Workbook workbook = WorkbookFactory.create(is);
возникала ошибка времени выполнения
java.lang.NoClassDefFoundError: javax.xml.stream.XMLEventFactory
Оператор new XSSFWorkbook(is)
также приводил к ошибке.
Что нужно сделать, чтобы проект запустился и была возможность работать с файлами формата *.xlsx?