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.

stderr[

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(CallSiteWriter.java:58)
  	at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:317)
  	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:307)
        etc etc etc....

You should take a look at this: