tbroyer / gradle-errorprone-plugin

Gradle plugin to use the error-prone compiler for Java
Apache License 2.0
366 stars 32 forks source link

Does Errorprone support android gradle projects? #90

Closed vivian196167 closed 1 year ago

vivian196167 commented 1 year ago

We have many android application projects which use gradle 6.5 and android gradle plugin com.android.tools.build:gradle:4.2.2. I have upgrade gradle to 6.8.1, but it cannot print errors as I add the bellos code snippet.

public String test1() { Set s = new HashSet<>(); for (short i = 0; i < 100; i++) { s.add(i); s.remove(i - 1); } System.out.println(s.size()); return "Hello World!"; }

Does error-prone support android gradle application? at what version at least should android gradle plugin be used?

tbroyer commented 1 year ago

There used to be code in the plugin to specifically support Android projects but I eventually removed it in version 3 as I could make sense of how things were moving on in AGP and how one was supposed to configure tasks with their new model.

There's a bit more context in https://github.com/tbroyer/gradle-errorprone-plugin/releases/tag/v3.0.0

TL;DR: JavaCompile tasks are enhanced to support ErrorProne, but one has to configure the dependencies and somehow enable ErrorProne on the tasks. I have no idea how to do this though 🤷 I'm encouraging anyone to make an Android-specific plugin to complement this plugin and go that extra mile.