API级别低于24的版本不支持默认方法boolean methodname()

时间:2017-11-21 07:05:52

标签: java android android-gradle android-7.0-nougat

我已将我的java编译版本更改为1_8。

Error: C:\Users\mah\Desktop\Test\views\index.pug:2:1
    1| doctype html

  > 2|     link(rel='stylesheet', href='../CSS/requirements.css')

-------^
    3|     script(src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js')

    4|     body

    5|       p = content


unexpected token "indent"
    at makeError (C:\Users\mah\Desktop\Test\node_modules\pug-error\index.js:32:13)
    at Parser.error (C:\Users\mah\Desktop\Test\node_modules\pug-parser\index.js:53:15)
    at Parser.parseExpr (C:\Users\mah\Desktop\Test\node_modules\pug-parser\index.js:264:14)
    at Parser.parse (C:\Users\mah\Desktop\Test\node_modules\pug-parser\index.js:112:25)
    at parse (C:\Users\mah\Desktop\Test\node_modules\pug-parser\index.js:12:20)
    at Object.parse (C:\Users\mah\Desktop\Test\node_modules\pug\lib\index.js:126:22)
    at Function.loadString [as string] (C:\Users\mah\Desktop\Test\node_modules\pug-load\index.js:45:21)
    at compileBody (C:\Users\mah\Desktop\Test\node_modules\pug\lib\index.js:86:18)
    at Object.exports.compile (C:\Users\mah\Desktop\Test\node_modules\pug\lib\index.js:243:16)
    at handleTemplateCache (C:\Users\mah\Desktop\Test\node_modules\pug\lib\index.js:216:25)

之后我运行了我的项目,得到了以下错误,不知道该怎么办?

  defaultConfig {
    jackOptions {
        enabled true
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
 }

有人可以请你解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

Jack - 编译器已弃用,不应使用。如果您使用的是Android Studio 3.0,则只需切换到支持Java 8功能的新desugar功能,例如default - 任何minSdkVersion的方法。

此处描述desugar的功能以及如何从杰克切换到当前解决方案:

Use Java 8 Language Features