title: Install and integrate Apache OpenNLP in Android Studio
body: <p>I am developing a ChatBot android application for which I wanted to use Apache OpenNLP library. I have followed this <a href="https://www.tutorialspoint.com/opennlp/opennlp_environment.htm" rel="nofollow noreferrer">tutorial</a> to download and use OpenNLP. After downloading the zip files, I was told to add 2 jar files to Android Studio as libraries which I have done. Then I have added the compile options to the build.gradle file of the modules directory. When I tried running the app, I got a Gradle Build error as following</p>
  
  <pre><code>&gt; 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.
  </code></pre>
  
  <p>Then I have added the following lines to my gradle file</p>
  
  <pre><code>compileOptions{
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  </code></pre>
  
  <p>After doing this, when I try to run the code. I get this failed gradle sync</p>
  
  <pre><code> 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.
  </code></pre>
  
  <p>Then I add the following to my gradle file inside the defaultConfig block</p>
  
  <pre><code>jackOptions{
              enabled true
          }
  </code></pre>
  
  <p>After this when I try to run my app, I get the maximum number of errors</p>
  
  <pre><code>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'.
  &gt; com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception 
  </code></pre>
  
  <p>Could anyone please tell me what to do? I would like to be able to use OpenNLP methods in my application. I have tried cleaning and rebuilding but in vain. </p>