AndroidStudio配置使用lambda

官网说明
要开始使用受支持的 Java 8 语言功能,请更新 Android 插件到 3.0.0(或更高版本)。 然后,针对使用(包括在源代码中或通过依赖项使用)Java 8 语言功能的每个模块,在其 build.gradle 文件中添加以下代码:

android {
  ...
  // Configure only for each module that uses Java 8
  // language features (either in its source code or
  // through dependencies).
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

即可使用lambda

猜你喜欢

转载自blog.csdn.net/zhe_ge_sha_shou/article/details/79379543