我想使用tika库,但不能
当我要运行项目时,它会给我这个错误
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/shivlabnewpc2/.gradle/caches/modules-2/files-2.1/org.apache.tika/tika-core/1.21/3c297fba4e75b1eeba2ecd6fabb7dbe13dfcb71/tika-core-1.21.jar
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException: Error: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
这是我的build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion myCompileSdkVersion
defaultConfig {
minSdkVersion myMinSdkVersion
targetSdkVersion myTargetSdkVersion
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'javax.xml.stream:stax-api:1.0-2'
implementation 'net.sourceforge.streamsupport:streamsupport:1.6.0'
implementation 'com.android.support:multidex:1.0.3'
implementation ('org.apache.tika:tika-parsers:1.21'){
exclude group: 'commons-logging'
exclude group: 'org.apache.httpcomponents'
exclude group: 'org.apache.xmlbeans'
exclude group: 'com.sun.activation'
exclude group: 'jakarta.activation'
exclude group: 'xml-apis'
exclude group: 'javax.xml.stream'
}
}
问题是什么?我尝试添加multidex
清理并重建项目,重新启动android studio等,但此错误无法解决
请帮助我解决这个问题