【问题标题】:DexArchiveBuilderException exception when using stanford corenlp使用 stanford corenlp 时出现 DexArchiveBuilderException 异常
【发布时间】:2018-05-29 12:26:10
【问题描述】:

我正在尝试使用 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() 错误: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.DexArchiveBuilderException: 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

请帮助我为什么每次运行我的应用程序时都会出现以下异常。

【问题讨论】:

  • 任何不赞成投票的理由

标签: java android stanford-nlp lemmatization


【解决方案1】:

我深入理解了为什么它需要最低 v24 。它只允许 v24 及更高版本的原因是它使用 java 1.8,我相信它仅在 v24 及更高版本中受支持。

所以我改变了 compile 'edu.stanford.nlp:stanford-corenlp:3.8.0' compile 'edu.stanford.nlp:stanford-corenlp:3.4.1' 它对我有用,您可以阅读here

【讨论】:

    【解决方案2】:

    您的堆栈跟踪输出:

    com.android.tools.r8.errors.CompilationError: 默认界面 仅从 Android N (--min-api 24) 开始支持方法

    所以你必须将你的minSdkVersion 升级到 24

    编辑: Enabling java 8 compatibiliy 解决问题:将下面的块添加到build.gradle

    compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    

    【讨论】:

      猜你喜欢
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-26
      • 1970-01-01
      • 1970-01-01
      • 2017-02-25
      相关资源
      最近更新 更多