java - 使用 stanford corenlp 时出现 DexArchiveBuilderException 异常
问题描述
我正在尝试使用stanford corenlp对单词进行词形还原但是当我添加了如下依赖项时。
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
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'
compile 'ai.api:sdk:2.0.7@aar'
compile 'ai.api:libai:1.6.12'
compile 'com.android.support:appcompat-v7:27.1.1'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile 'edu.stanford.nlp:stanford-corenlp:3.8.0'
}
repositories {
mavenCentral()
}
当我运行我的应用程序时,它给了我以下异常:
错误:com.android.builder.dexing.DexArchiveBuilderException:无法处理 C:\Users\LPT-0096.gradle\caches\modules-2\files-2.1\edu.stanford.nlp\stanford-corenlp\3.8.0\ 79c0ba8dba9734bf51d898f4526117980f7c49c5\stanford-corenlp-3.8.0.jar 错误:com.android.builder.dexing.DexArchiveBuilderException: com.android.tools.r8.errors.CompilationError: 默认接口方法仅支持从 Android N (--min- api 24): void edu.stanford.nlp.pipeline.Annotator.unmount() Error:com.android.tools.r8.errors.CompilationError: 默认接口方法仅支持从 Android N (--min-api 24) 开始: void edu.stanford.nlp.pipeline.Annotator.unmount() 错误:任务“:ModroidApp:transformClassesWithDexBuilderForDebug”执行失败。com.android.build.api.transform.TransformException:com.android.builder.dexing。
请帮助我为什么每次运行我的应用程序时都会出现以下异常。
解决方案
Your stack trace output :
com.android.tools.r8.errors.CompilationError: Default interface methods are only supported starting with Android N (--min-api 24)
So you have to ugrade your minSdkVersion
to 24
EDIT:
Enabling java 8 compatibiliy solve the issue : adding the block below to build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
推荐阅读
- visual-studio-code - 将光标(插入符号)移动到当前视图
- r - 循环遍历变量并进行置换意味着每个变量的差异测试
- reactjs - 我们如何配置 dotnet core react 应用程序以使用多条目?
- c# - 在编写 DefaultTrackableEventHandler.cs 脚本时,如何修复“成员修饰符“受保护”必须位于成员类型和名称之前
- c - C列表多线程同步
- java - java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Handler
- python - 如何使用for循环使用python脚本将值1-100插入redis?
- python - 将熊猫数据框的日期与当前日期进行比较
- docker - 如何从 docker 取消设置环境变量?
- docker - 仅在使用 Dockerfile 进行生产时,如何复制文件?