title: Cannot use lambda functions in Android with Java 1.8
body: <p><strong>The library I'm using is <a href="https://github.com/atorstling/bychan" rel="nofollow noreferrer">bychan</a>, I can't even include it in a Nougat empty app project either loaded as module or through jar.</strong></p>
  
  <p>So this is an example of what was returned in Android Studio's messages:</p>
  
  <p><strong>Can someone explain what they mean by "unknown interface" in the errors below?</strong></p>
  
  <pre><code>Error:TokenDefinitionBuilder.java:118-119: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.function.Function
  Error:TokenDefinitionBuilder.java:118-119: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.function.Predicate
  ...
  Error:com.android.jack.JackAbortException
  </code></pre>
  
  <p>This came from a library I've used. I thought adding the types in angle brackets would help? I don't know if it did anything though.</p>
  
  <p>This is the line 118-119 in that library:</p>
  
  <pre><code>strings.stream().&lt;StringMatcher&gt;map(StringMatcher::new).map(
      m -&gt; m.tryMatch(input, searchStart)).filter(Objects::nonNull).findFirst().orElse(null));
  </code></pre>
  
  <p>I'm not sure what it is complaining about? What should I do or change to evade this problem? <strong>I had thought that maybe Android doesn't support Lambda Expressions, but the error clearly stated "Lambda coming from...", which means it recognized I used a lambda expression.</strong></p>
  
  <p>Please help.</p>
  
  <hr>
  
  <h3>Update</h3>
  
  <p><strong>I have included the library by compiling it in a jar inside another jar library</strong>, if that helps. I'm new to the world of Android if you can't tell.</p>
  
  <h3>Updates 2</h3>
  
  <p>I don't think this is related to the API version? I've set my build target to <strong>25</strong>. But the build is still failing.</p>
  
  <p>Also, if you look below, I don't see an option for 1.8? But <strong>I've set the build JDK to my 1.8 JDK location</strong>.</p>
  
  <p><a href="https://i.stack.imgur.com/buLMO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/buLMO.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/CMFwm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CMFwm.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <h3>Gradle</h3>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.0"
      defaultConfig {
          applicationId "this.is.where.i.have.my.id"
          minSdkVersion 25
          targetSdkVersion 25
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
          jackOptions {
              enabled true
          }
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:25.0.1'
      compile 'com.android.support:support-v4:25.0.0'
      compile 'com.android.support:design:25.0.0'
      compile 'com.android.support:preference-v7:25.0.0'
      compile 'com.android.support:preference-v14:25.0.0'
      compile 'com.google.android.gms:play-services-appindexing:9.8.0'
      testCompile 'junit:junit:4.12'
      compile 'com.google.code.gson:gson:2.8.0'
      compile files('libs/my_lib_that_contains_lambda.jar')
  }
  </code></pre>