2017-05-01 4 views
1

Apache OpenNLP 라이브러리를 사용하고자하는 ChatBot android 응용 프로그램을 개발 중입니다. 나는이 tutorial을 따라 OpenNLP를 다운로드하여 사용했다. zip 파일을 다운로드 한 후 Android Studio에 2 개의 jar 파일을 라이브러리로 추가하라는 지시를 받았습니다. 그런 다음 modules 디렉토리의 build.gradle 파일에 컴파일 옵션을 추가했습니다. 나는 응용 프로그램을 실행했을 때, 나는이를 실행하려고하면,Android Studio에서 Apache OpenNLP 설치 및 통합

> Error:Error converting bytecode to dex: 
Cause: Dex cannot parse version 52 byte code. 
This is caused by library dependencies that have been compiled using Java 8 or above. 
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7' 
sourceCompatibility = '1.7' 
to that submodule's build.gradle file. 

그럼 내가이 일을 한 후 내 Gradle을 파일

compileOptions{ 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
} 

에 다음 줄을 추가 한 다음과 같은 Gradle을 빌드 오류가 발생했습니다 암호. 나는 이것이 내가 내 응용 프로그램을 실행하려고하면이 후

jackOptions{ 
      enabled true 
     } 

을 차단, 나는 오류의 최대 수를 얻을 defaultConfig 안에 내 Gradle을 파일에 다음을 추가 그리고 Gradle을 동기화

Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8. 
Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8. 

실패 수

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.io.FileFilter 
Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.io.FileFilter 
Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.io.FileFilter 
Error:Default method void updateAdaptiveData(java.lang.String[] tokens, java.lang.String[] outcomes) not supported in Android API level less than 24 
Error:Default method void clearAdaptiveData() not supported in Android API level less than 24 
Error:Default method void reset() not supported in Android API level less than 24 
Error:Default method void close() not supported in Android API level less than 24 
Error:Execution failed for task ':app:transformClassesWithPreJackPackagedLibrariesForDebug'. 
> com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception 

아무에게도 무엇을해야할까요? 내 응용 프로그램에서 OpenNLP 메서드를 사용할 수 있기를 원합니다. 나는 청소와 재건을 시도했지만 헛된.

답변

0

아래의 그라디언트 변경 사항은 저에게 잘 돌아갔습니다. 시험 사용해 볼 수 있습니다.

dependencies { 
    classpath 'com.android.tools.build:gradle:1.5.0' 
} 

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.2' 

    compileOptions { 
      sourceCompatibility JavaVersion.VERSION_1_7 
      targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

dependencies { 
     compile 'org.apache.opennlp:opennlp:1.6.0' 
}