Error:Jack is required to support java 8 language features. Either enable Ja

解决办法:

在app目录下的build.gradle下加上以下配置:

 jackOptions {
            enabled true
        }

Error:Jack is required to support java 8 language features. Either enable Ja_第1张图片
如下:关键的代码

android {
    compileSdkVersion rootProject.ext.android.compileSdkVersion
    buildToolsVersion rootProject.ext.android.buildToolsVersion

    defaultConfig {
        applicationId "..."
        minSdkVersion rootProject.ext.android.minSdkVersion
        targetSdkVersion rootProject.ext.android.targetSdkVersion
        versionCode rootProject.ext.android.versionCode
        versionName rootProject.ext.android.versionName
      
        //这句很关键
        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
    }
}

你可能感兴趣的:(Android)