How to fix Android Gradle Failure?
Unity Version: 2017.30b4 (although I have also tried the latest release build) macOS Sierra 10.2.6 android studio 2.3.3 latest NDK installed latest Java installed
I have tried to fix this issue by following this process (but for Mac):
Go to your Android SDK Folder. (If you did not change the path during Android Studio installation you will find the SDK folder here: C:\Users\YourUsername\AppData\Local\Android\sdk )
Rename the old Android sdk "Tool" folder : [Your Android SDK root]/tools -> toolsXXXX
Download Android SDK Tools, Revision 25.2.5 (January 2017): http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip
This fix got me further in the build process, but I'm still getting a failure:
CommandInvokationFailure: Gradle build failed. /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/java -Xmx1024M -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "--no-daemon" "assembleDebug"
I am still having this issue after trying to build with Unity 2007.2.0f3.
Answer by sadsa · Mar 29, 2018 at 10:59 AM
Changed from Gradle to Internal on build settings and it worked
The question was how to fix the Gradle error, not how to not use Gradle. :P
Swithing to Internal give me another error 'Failed to build apk. See Console for details.'. Then after downgrading jdk 12 to jdk 8 it worked for me. But simply downgrading jdk still results in the same error.
Answer by Alstev · Mar 20, 2018 at 04:37 PM
Hello!
Downgrading to Java jdk 8 (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) was part of the answer for me.
It only worked after I ALSO went to Android Studio-->Settings -->SDK tools --> uninstall the update 28-rc1
(I had to do this because I had previously installed the r25.2.5 version of SDK manually by replacing the tools, but the 28-rc1 version will not be compatible with the downgraded Java jdk, causing yet another problem)
This are the two answers I combined in order to solve my problems:
https://answers.unity.com/questions/1323731/unable-to-list-target-platforms-please-make-sure-t.html
https://answers.unity.com/questions/1478218/build-error-unity201731f1.html
Hope This helped :)
Yes! Thanks so much, uninstalling 28-rc was my missing step!
Thanks! I had the right JD$$anonymous$$, but your comment on downgrading the SD$$anonymous$$ helped me. The Oculus documentation mentioned Android SD$$anonymous$$ Build Tools, v 26.0.2 and that worked for me
Thank you! $$anonymous$$y Sunday and $$anonymous$$onday night gone... but you have made my Tuesday! I found by downgrading to Java 8 was able to fix the issue per your assist!
Answer by DistantLifeform · Mar 04, 2018 at 03:52 AM
use jdk 8 instead of 9 and it will build successfully, just tested and it works.
yes - thank you it worked perfected when i installed jdk 8 ins$$anonymous$$d of 9
i had jdk 10 and removing it and having 8 installed helped. didnt need to touch Andriod SD$$anonymous$$
Answer by ddyer9 · Mar 07, 2018 at 08:16 PM
This problem took me two days to figure out after reinstalling Android SDK, updating all my files, following Google quick-start guide to the best of my ability. Replacing the tools folder with the older version did fix the SDK path issue but then I was getting this same Gradle issue.
As someone mentioned above what fixed this for me was replacing the JDK. Java SE Development Kit 8u161 is the version that worked for me. All I can say is.... hallelujah!
Answer by mechangel · Oct 18, 2017 at 12:06 AM
Fixed by following these directions to swap out the Tools folder. http://answers.unity3d.com/questions/1320634/unable-to-list-target-platforms-when-i-try-to-buil.html
Your answer

Follow this Question
Related Questions
Unity 2017.2.0b9 ARCore build&run with Pixel XL (Android 8.0) Failed 0 Answers
Package Appears to be Corrupt error on Android,Package appears to be corrupt on android?? 0 Answers
Devices No Longer Supported | When releasing app on google playstore 0 Answers
WINDOWS 10 DllNotFoundException: sqlite3 0 Answers
I cant build my game for Android. 0 Answers