Need Help With Gradle

I cannot get Unity to build using Gradle at all.
Initially I was getting error stating that minimum Gradle needed is 2.14 and current Gradle version is 2.1.

Now I am getting
A problem occurred configuring root project ‘gradleOut’.

Failed to notify project evaluation listener.
javax/xml/bind/annotation/XmlSchema

However building using Gradle under Android Studio works fine.
I am beginning to suspect that Gradle just will not work with Unity.

I need help desperately. Everything I have tried has failed and I have wasted too much time on this.

Tried all that. The errors that are occurring are not covered in the troubleshooting guide. Build also fails using custom template or generated template doesn’t matter. It fails right out of the box and yet succeeds in both Unreal and Android Studio.

After trying everything under the sun it appears that the problem was related to using Java 9 with Gradle. I stumbled on an obscure post that stated Gradle will not work with Java 9 and is unstable with Java 8. The last stable Java JDK that Gradle works with is Java 7 JDK. After installing Java 7 JDK and building, Gradle built without any errors. Proguard will not work now but at least I am on the right track.

Where did you download jdk 7? I cant find it anywhere!

I still have Java 9 installed but also installed both JDK 7 and 8 Gradle actually builds fine with JDK 8 but either 7 or 8 will work. There just isn’t any support for JDK 9 and I wish they would document that. It would save a lot of people a lot of time.

Anyway, JDK 7 and 8 can be found in the same place 9 is but in the Oracle archives. Oracle requires you to create an account there if you don’t already have one in order to download from their archives though.

JDK 7 http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
JDK 8 http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html

1 Like

Hello Friends,

I just tried using JDK 7 and got following errors :
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.7.0_80\bin\java.exe -classpath “C:\Program Files\UnitySelfieChimp\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx2048m” “assembleRelease”

stderr[

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘D:\WIP\SelfieChimpGit\SCProjectFiles(Android)\Temp\gradleOut\build.gradle’ line: 20

  • What went wrong:
    A problem occurred evaluating root project ‘gradleOut’.

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

I have tried JDK 8 & 9 as well but with them I get unable to find Build Tools 28.0.0. error

Please help!!!

Thanks & Regards,
Bhanu

Are you getting that error with debug or release build? Try exporting your Unity project and building it in Android Studio. If you still get errors it may be a problem in your Android Manifest file.

Edit. From Android Studio SDK Manager make sure you update all the Android SDKs and Gradle files. Are you using a custom Gradle file? If so uncheck the using Custom Gradle and see if that works. It may be something simple as outdated Gradle or unsupported Android versions.