AndroidStudio 配置java1.8 lambda

2017年底了做完总结,没有特别事情,将所有工具和插件以及三方的SDK都检查和更新了一遍。

java1.7也升级到了1.8 顺便配置一下新的特性lambda


有两种方式

配置流程:
defaultConfig { ..
// one
jackOptions {
enabled true
}
//two
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}



不过在我升级AndroidStudio 3.0.1时 gradle 编译时提示警告

Warning:The Jack toolchain is deprecated and will not run. To enable support for Java 8 language features built into the plugin, remove 'jackOptions { ... }' from your build.gradle file, and add


android.compileOptions.sourceCompatibility 1.8
android.compileOptions.targetCompatibility 1.8


Future versions of the plugin will not support usage of 'jackOptions' in build.gradle.
To learn more, go to https://d.android.com/r/tools/java-8-support-message.html



只用

defaultConfig {

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值