Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

CommandInvokationFailure: Gradle build failed.

Discussion in 'Android' started by neufoctobre, Oct 23, 2018.

  1. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    70
    Hi Everyone !

    I got a problem using Unity 2018.2.13f1, I can't build and get an error.

    I checked many forum but don't find any answer to solve this problem.
    I already tried to reinstall JDK8. I tried to build with IL2CPP with JNK, and I also try to build with internal process but get unable to convert dex format.
    I always get the error and this is totally out of my skills.

    Does anyone have this problem and found the solution ?

    Thanks in advance :)

    Here is the error message :

    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. C:\Program Files\Java\jdk1.8.0_191\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
    3.  
    4. stderr[
    5.  
    6. FAILURE: Build failed with an exception.
    7.  
    8. * What went wrong:
    9. A problem occurred configuring root project 'gradleOut'.
    10. > Could not resolve all files for configuration ':classpath'.
    11.    > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
    12.      Searched in the following locations:
    13.          https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar
    14.  
    15. * Try:
    16. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    17.  
    18. * Get more help at https://help.gradle.org
    19.  
    20. BUILD FAILED in 14s
    21. ]
    22. stdout[
    23. Starting a Gradle Daemon (subsequent builds will be faster)
    24. ]
    25. exit code: 1
    26. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    27. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    28. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
    29. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)
    30. Rethrow as GradleInvokationException: Gradle build failed
    31. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)
    32. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    33. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    34. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    35.  
     
  2. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    64
    Greej likes this.
  3. Greej

    Greej

    Joined:
    Jun 13, 2017
    Posts:
    2
    This saved me. I spent several hours last night trying to figure out what was wrong. Reinstalled SDK, JDK. This worked for me.The link doesn't take me anywhere though...
     
  4. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    64
    Link should be up now. I literally reported this, and then went to forums so the system hadn't grabbed it yet : )
     
  5. Greej

    Greej

    Joined:
    Jun 13, 2017
    Posts:
    2
    Awesome. Thanks.
     
  6. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    67
  7. veevoogames

    veevoogames

    Joined:
    Aug 12, 2018
    Posts:
    1
    same issue as what thibouf said, the workaround will work for some people, but as im using firebase and other plugins, i still get the error when i build, though the error will then say firebase cant find the path, please fix
     
    Last edited: Oct 25, 2018
  8. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    64
    Could you try doing this and letting me know if it helps? If it does I'll add it to the workaround. But do attempt this at your own risk. This is kinda for the 'adventurous' and people that can't wait for the proper fix (Which should be soon, already in QA).

    1. Go to unity install location (Let's say C:\Unity 2018.3.0b7\)
    2. Go Editor > Data > PlaybackEngines > AndroidPlayer > Tools > GradleTemplates
    3. Open libTemplate.gradle in a text editor (I prefer something like sublime, but do whatever works for you. I wouldn't recommend the default Notepad tho, it might frick up the line endings, not sure.)
    4. Switch line 3 and 4, so that google is on top.
     
  9. daniel-hall

    daniel-hall

    Joined:
    Sep 14, 2015
    Posts:
    2
  10. idioti

    idioti

    Joined:
    May 13, 2014
    Posts:
    8
    This works! No problem, build successful
     
  11. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    This is one combined with the original one is the solution!
     
  12. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    35
    Is there an expected fix coming for cloud build that doesn't involve overriding the gradle build scripts...?
     
  13. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    64
    Sorry, I am not familiar with cloud builds. I assume they are using latest-ish versions (or what ever you select)?
    If so, using the 2017.4LTS (which was unaffected) or the upcoming 2018.2.15f1, 2018.3.0b10 or 2019.1.0a7 which have the fixes built should solve the problem.
     
  14. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    70
    New problem with 2018.2.15f1 :
    What's going wrong with new unity ?!?! Unable to build any project since 2018 ...

    A problem occurred configuring root project 'gradleOut'.
    > No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android



    EDIT :
    Ok removing NDK tools solved the problem
     
    Last edited: Nov 12, 2018
  15. roshan090

    roshan090

    Joined:
    Mar 20, 2018
    Posts:
    22
    i am still stuck in error. please help me. i am doing all what you said. i am using an old version native plugin that is why i got this error. help me i am stuck in this error till now.
     

    Attached Files:

  16. Ina_Sh

    Ina_Sh

    Joined:
    Jul 25, 2017
    Posts:
    1
    i did every one of these but still can't build. what if i use internal build system instead?
    version :2018.2.11f1
     
  17. hiagotruta

    hiagotruta

    Joined:
    Jan 27, 2015
    Posts:
    4
    I still have the problem.
    Someone can help me?
     
  18. developerarreterra

    developerarreterra

    Joined:
    Oct 8, 2018
    Posts:
    5
    So, i had exactly the same problem and tried out a lot.
    What worked for me is to clear the .gradle folder inside my %Userfolder%
    When you build it will download the entire folder again (Unity will say it crashed, but Java is going strong). and after that I could build again!

    Hopes this works!
     
    LAKSHAYMAVIA likes this.
  19. abolfazl-tanha

    abolfazl-tanha

    Joined:
    Nov 22, 2015
    Posts:
    3
    Hello, i have same problem and i did all of works that you said in last posts but i couldn't t APK . My unity version is 2018.3.5 and i have all versions of Android SDK and JDK and NDK .

    Please Help me !!!
     
  20. abolfazl-tanha

    abolfazl-tanha

    Joined:
    Nov 22, 2015
    Posts:
    3
    Hello, i have same problem and i did all of works that you said in last posts but i couldn't t APK . My unity version is 2018.3.5 and i have all versions of Android SDK and JDK and NDK .

    Please Help me !!!
     
  21. femoreti

    femoreti

    Joined:
    May 9, 2014
    Posts:
    4
    OMG This saved me. Thanks!! Using Unity 2018.2.11f1
     
  22. Jackimaru

    Jackimaru

    Joined:
    Jun 10, 2019
    Posts:
    2
    This worked for me. Using latest 2019.1.6f1
     
  23. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    15
    Thanks this works.
     
  24. gamingsauce

    gamingsauce

    Joined:
    Apr 21, 2018
    Posts:
    2
    Please guys tell me where is the %Userfolder%