Error: Invoke-customs are only supported starting with Android O (–min-api 26)

  • A+
所属分类:Android异常

在使用Gradle编译安卓项目时出现以下错误:

Error: Invoke-customs are only supported starting with Android O (--min-api 26)

只需要在app模块下的build.gradle的android节点下添加:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

如下图:

avatar