Android studio( lambda expressions are not supported at this language level)

  1. 在全局的build.gradle中添加classpath 'me.tatarka:gradle-retrolambda:3.2.0',如图
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'me.tatarka:gradle-retrolambda:3.2.0'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2'
     ...
  1. 在module的build.gradle中添加如下compileOptions

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.chaos.fabricsdk"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    compileOptions{
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    ...

经过上面两步,rebuild项目,结果运行正常。

推荐阅读更多精彩内容