gradle build error when update from 5.6.4p4 to 2017.3.1f1

i got this error when trying to build now on 2017.3.1f1 i have no clue about it, if someone has a problem similar and could help , would be great

CommandInvokationFailure: Gradle build failed. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleDebug"


FAILURE: Build failed with an exception.

* Where:
Build file '/Users/hernanzambrano-astete/Workspace/Unity/thomasandfriends-raceon/Temp/gradleOut/build.gradle'

* What went wrong:
Could not compile build file '/Users/hernanzambrano-astete/Workspace/Unity/thomasandfriends-raceon/Temp/gradleOut/build.gradle'.
> startup failed:
  General error during class generation: 956
  java.lang.ArrayIndexOutOfBoundsException: 956
  	at org.codehaus.groovy.classgen.asm.CallSiteWriter.getCreateArraySignature(
  	at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(

Actually in my case it seems to be related to StreamingAssets that are added in the aaptOptions one by one, overstepping the 250 elements limit in the array.

If it helps someone, when i use “Split Application Binary” (APK + OBB), error is go away…

Hi @Nuaro In Unity version of 2017 or later, only compatible with SDK 25.2.5 and JDK 1.8.161 (I think). So change your SDK → Tools with 25.2.5 version. If you don’t want to overwrite your tools folder you can rename it to something else.
Here is my SDK and JDK you can download and add it to the Unity → Preferences → External Build

hope it works on you. Insya Allah. Regards, Ikhsan Syahputra.

Thanks @ikhsaniks for the help, but i’m still getting the same error, if you have any other idea of what i could try i really appreciate. by the way i’m working on a OSX(Mac)

@linlinsky Apologies, I never updated this thread. I do believe I figured this out a few weeks after I last posted here. Though it’s not fresh in my mind, I do have some brief notes on it, which follow:

To get around the ArrayIndexOutOfBounds issues, I had to go into the custom mainTemplate.gradle file and change STREAMING_ASSETS to manually list out the wild carded filetypes contained in that folder (like “.hd”, “.sd”, “.manifest”)
Looking at the mainTemplate.gradle file in the Unity 5.6.5 project, I don’t have a STREAMING_ASSETS flag in it anymore, and it is simply:

aaptOptions {
    		noCompress '.unity3d', '.ress', '.resource', '.obb'

As mentioned I had another issue in 5.6.5 with duplicate BuildConfig files within plugins, and I’d discovered the fix to that at the same time:

To get around the duplicate BuildConfig issues, I manually went into the .jar files for the offending plugins - SwrveSDKPushSupport, SwrveSDKUnityBridge, and Notifications… opened it up as a zip file and simply deleted the BuildConfig file therein. Also had to make sure any created .meta files got deleted before re zipping back into a .jar file.

Hope this is helpful!

Just in case if anyone will have same issue. In my case the problem was over 300 asset bundle files. So I followed suggestion, turn on custom gradle file for project and then simply remove “STREAMING_ASSETS” which was creating extremely long list (because files in streaming asset folder were arranged in sub folders. However, you should not forget to add appropriate files manually… in my case I simply added ‘sound_effects/*’ at the beginning of the list. I personally do not understand why unity simply not add all sub-folders of SteamingAsset folder in ignore list via wild card or they are not supported?