Gradle build: Could not compile build.gradle error

So I upgraded to Unity 2017.4.1 from Unity 5.6.5 to get around this “duplicate BuildConfig.class” error when building with Gradle. It seems to have fixed it, though this new error may just be covering it up.

Now I’m facing this “General error during class generation” and/or ArrayIndexOutOfBoundsException. Not really sure what’s causing it or where to take it. Any thoughts very much appreciated.


FAILURE: Build failed with an exception.

* Where:
Build file '/Users/XXX/Projects/YYY/Temp/gradleOut/build.gradle'

* What went wrong:
Could not compile build file '/Users/XXX/Projects/YYY/Temp/gradleOut/build.gradle'.
> startup failed:
  General error during class generation: 289
  java.lang.ArrayIndexOutOfBoundsException: 289
  	at org.codehaus.groovy.classgen.asm.CallSiteWriter.getCreateArraySignature(
  	at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(
  	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(
        etc etc etc....

You should take a look at this: