Retrolambda: Lint crashes when using lambda expressions with retrolambda
You can use a special lombok version with lint which does not whine about Java 8 features.
buildscript { repositories { jcenter() ... } dependencies { classpath 'com.android.tools.build:gradle:<version>' classpath 'me.tatarka:gradle-retrolambda:<version>' classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' } // Exclude the version that the android plugin depends on. configurations.classpath.exclude group: 'com.android.tools.external.lombok'}
This way you can keep running lint on the whole project, even with the latest versions of the Android Gradle plugin.
Note: If you receive same errors, try to put the configuration above into the top most build.gradle
file. It should work then.
There is a GitHub issue that discusses this problem: https://github.com/evant/gradle-retrolambda/issues/96
One of the comments in the issue mentions that lint
never actually worked with retrolambda but rather, with the newest lint
version, is now "failing loudly" instead of simply skipping the rest of the file when a lambda was encountered.
With this in mind, it seems like there are two options. One, you could simply disable lint
like you mentioned in your question. Of course the problem with this is that you would lose the benefit of lint
scanning the rest of your code. The second option is to roll back your lint
version such that it is no longer "failing loudly" but rather simply skips checking the lambda-related source; this way, lint
can still scan the rest of your application source code.
According to the GitHub issue, rolling back your lint
version from 24.0.1
(you might have a different version) to 24.0.0
seems to fix the problem. You can find this information in the issue (link posted at beginning of answer).