Lambda expressions crash with IncompatibleClassChangeError in Android when using jack

陌路散爱 提交于 2019-12-03 05:33:11

Google are no longer supporting android-jack.

Jack is no longer supported, and you should first disable Jack to use the Java 8 support built into the default toolchain

Android Studio 3.0 and later supports Lambdas expressions. Configure build.gradle file:

android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
  sourceCompatibility JavaVersion.VERSION_1_8
  targetCompatibility JavaVersion.VERSION_1_8
 }
}

Note: If Android Studio detects that your project is using Jack, Retrolambda, or DexGuard, the IDE uses Java 8 support provided by those tools instead. However, consider migrating to the default toolchain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!