Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Gradle build failed. A problem occurred configuring root project 'gradleOut'. > Could not resolve al

Discussion in 'Android' started by tashfiq103, Dec 18, 2018.

  1. tashfiq103

    tashfiq103

    Joined:
    Mar 4, 2016
    Posts:
    15
    Is there anyone facing the issue when building your project for android. These are the following settings that has been configured in "Build Settings" & "Player Settings -> Other Settings"





    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. C:/Program Files/Java/jdk1.8.0_121\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.2.3f1\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 manifest-merger.jar (com.android.tools.build:manifest-merger:26.0.1).
    12.      Searched in the following locations:
    13.          https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.jar
    14.    > Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.0.1).
    15.      Searched in the following locations:
    16.          https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/26.0.1/ddmlib-26.0.1.jar
    17.    > Could not find dvlib.jar (com.android.tools:dvlib:26.0.1).
    18.      Searched in the following locations:
    19.          https://jcenter.bintray.com/com/android/tools/dvlib/26.0.1/dvlib-26.0.1.jar
    20.    > Could not find common.jar (com.android.tools:common:26.0.1).
    21.      Searched in the following locations:
    22.          https://jcenter.bintray.com/com/android/tools/common/26.0.1/common-26.0.1.jar
    23.  
    24. * Try:
    25. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    26.  
    27. * Get more help at https://help.gradle.org
    28.  
    29. BUILD FAILED in 0s
    30. ]
    31. stdout[
    32.  
    33. ]
    34. exit code: 1
     
  2. Bobby_F

    Bobby_F

    Joined:
    May 24, 2011
    Posts:
    9
    Just to second this, I'm getting the same 'Gradle build failed' error with missing manifest-merger-26.0.1.jar etc.
    Only thing done recently to the project was updating the Unity Facebook plugin ... tried reverting our project though and had the same error.

    Be grateful for any input, thanks.
    Running Unity 2018.2.13f1

    from the cloud build:
    88: [Unity] Player export failed. Reason: CommandInvokationFailure: Gradle build failed.
    89: [Unity] > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/facebook/android/BuildConfig;
     
    Last edited: Dec 18, 2018
  3. tashfiq103

    tashfiq103

    Joined:
    Mar 4, 2016
    Posts:
    15
    @Bobby_F .

    Yes, same thing happened to me after updating the "FacebookSDK". It was going perfectly okay while it had the "FirebaseSDK".

    Unity Version 2018.2.3f

    (1) I even wiped out the "AndroidSDK" and reinstalled the "BuildTools", doesn't work.
    (2) Re-importing all the plugins also doesn't work.
    (3) Changing "Build System" to "Internal" makes fail on merging manifest.
     
    Bobby_F likes this.
  4. Bobby_F

    Bobby_F

    Joined:
    May 24, 2011
    Posts:
    9
    I tried a new clean project in Unity 2018.2.16f and it built fine. The question now is whether or not to upgrade our project :)

    Just to confirm, upgrading the project got me past the original gradle error you posted but I now have the same cloud build error in the editor:

    Execution failed for task ':transformDexWithDexForRelease'.
    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/facebook/android/BuildConfig;
     
    Last edited: Dec 18, 2018
  5. Bobby_F

    Bobby_F

    Joined:
    May 24, 2011
    Posts:
    9
    Fixed this by uninstalling the Facebook sdk, running a build to check it was working ok, then re-installing the FB sdk.
    Cheers
     
  6. tashfiq103

    tashfiq103

    Joined:
    Mar 4, 2016
    Posts:
    15
    Hey @Bobby_F.

    Uninstalling mean deleting all the package and re-importing the FacebookSDK package?
     
  7. ImbaGame

    ImbaGame

    Joined:
    Jan 29, 2015
    Posts:
    13
  8. LeifStro

    LeifStro

    Joined:
    Mar 23, 2015
    Posts:
    29
    Same problem here:


    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring project ':Firebase'.
    > Could not resolve all files for configuration ':Firebase:classpath'.
    > Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/and...fest-merger/26.0.1/manifest-merger-26.0.1.jar
    > Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/26.0.1/ddmlib-26.0.1.jar
    > Could not find dvlib.jar (com.android.tools:dvlib:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/dvlib/26.0.1/dvlib-26.0.1.jar
    > Could not find common.jar (com.android.tools:common:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/common/26.0.1/common-26.0.1.jar

    Definitely an issue with jcenter().
     
    eggteng likes this.
  9. imran4125

    imran4125

    Joined:
    Jul 12, 2017
    Posts:
    17
    Hi,
    I am having the same issue... i created my build last week and it got created and today when i created it again i got this exact same issue.
    How did you fix this ?
    Thanks
     
  10. imran4125

    imran4125

    Joined:
    Jul 12, 2017
    Posts:
    17
    Hi,
    I am having the same issue... i created my build last week and it got created and today when i created it again i got this exact same issue.
    How did you fix this ?
    Thanks
     
  11. aseke0820

    aseke0820

    Joined:
    May 19, 2018
    Posts:
    2
    I have the same issue here.
     
  12. juyujuyu

    juyujuyu

    Joined:
    Nov 23, 2015
    Posts:
    2
    I have the same issue here!
     
  13. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    You probably have a custom build.gradle template which is missing `google()` repository dependency. It should also be the first in the list, before `jcenter()`.
     
  14. FrostweepGames

    FrostweepGames

    Joined:
    Jan 2, 2015
    Posts:
    264
    same issue.

    havent custom build.gradle
     
  15. developerarreterra

    developerarreterra

    Joined:
    Oct 8, 2018
    Posts:
    17
    I've tried this, but i still get the error.

    @Yury-Habets, i tried with and without custom build.gradle template, with Google() first and jcenter() first. Both don't work.

    Has anybody figured out what's wrong?
     
  16. developerarreterra

    developerarreterra

    Joined:
    Oct 8, 2018
    Posts:
    17
    With a custom build.gradle template with Google() first i still get this error:

    A problem occurred configuring project ':Firebase'.
    > Could not resolve all files for configuration ':Firebase:classpath'.
    > Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/and...fest-merger/26.0.1/manifest-merger-26.0.1.jar
     
  17. developerarreterra

    developerarreterra

    Joined:
    Oct 8, 2018
    Posts:
    17
    I see that :Firebase has his own build.gradle which still has jcenter() as first.
    I don't think i can change that myself...
     
  18. developerarreterra

    developerarreterra

    Joined:
    Oct 8, 2018
    Posts:
    17
    I Fixed it!
    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!
     
    guneyozsan, Aligdev, Nolex and 12 others like this.
  19. unity_xrPBQ-2zcfd-DA

    unity_xrPBQ-2zcfd-DA

    Joined:
    Jun 15, 2018
    Posts:
    19
    Hey I was facing the same issue what worked for me is

    1.Change the position of jcenter and google in project gradle file and in also all the other module you have in your project. Like in mine I have crashlytics, fabric so just remember to make the changes in their build.gradle file as well

    buildscript {
    repositories {
    jcenter()
    google()
    }
    to

    buildscript {
    repositories {
    google()
    jcenter()
    }
    2. Before building your project again go to your project folder and delete the .gradle folder from your project and then build your project.
     
  20. tashfiq103

    tashfiq103

    Joined:
    Mar 4, 2016
    Posts:
    15
    I switched the Unity Version to 2018.3.0f . Got fixed it for me.
     
    Bobby_F likes this.
  21. addy55

    addy55

    Joined:
    May 2, 2014
    Posts:
    5
    This the only thing that worked amongst all other solutions. Thanks!
     
  22. Garrettec

    Garrettec

    Joined:
    Nov 26, 2012
    Posts:
    98
    For Mac you can run rm -rf $HOME/.gradle/caches/ in terminal. And it should help
     
  23. Firestorm200

    Firestorm200

    Joined:
    Sep 29, 2013
    Posts:
    5
    God bless you, This actually worked after spending hours re-installing JDKs and NDK only deleting all that inside the .gradle folder worked
     
  24. bzeng

    bzeng

    Joined:
    Feb 1, 2019
    Posts:
    1
    thank you so much, your answer saves my day
     
  25. Rafael-cmk

    Rafael-cmk

    Joined:
    Jun 28, 2016
    Posts:
    56
    God bless you! my hero!
     
  26. Haseebahmed

    Haseebahmed

    Joined:
    May 27, 2018
    Posts:
    1
    Great Help. Thank you.
     
  27. zenter_games

    zenter_games

    Joined:
    Jun 7, 2018
    Posts:
    1
    Thank you so much,
     
  28. hashim08

    hashim08

    Joined:
    Mar 28, 2019
    Posts:
    1
    You beauty..
    Thank you so much!
     
  29. hschae_wgames

    hschae_wgames

    Joined:
    Jun 8, 2018
    Posts:
    1
    Marvelous! it works like magic.
     
  30. cradiff

    cradiff

    Joined:
    Feb 7, 2015
    Posts:
    66
    Can you tell me where is %Userfolder%?
     
  31. nil4mp

    nil4mp

    Joined:
    Dec 3, 2019
    Posts:
    2
    Thanks so much for the solution. I was struggling with this problem for 5 days. tried uninstalling versions of unity, creating new project and importing all assets from the beginning, tried all versions of NDK,JDK,GRADLE and their combinations and nothing worked. It turned out that i used android studio to create an android app and that maybe changed the .gradle folder inside my %Userfolder% and unity could not build my project. After testing your solution all was correct. Thanks so much.
     
  32. Cr0c

    Cr0c

    Joined:
    Jun 24, 2015
    Posts:
    1
    Same issue. Solve same. 2019.4.3f1
     
  33. Athomield3D

    Athomield3D

    Joined:
    Aug 29, 2012
    Posts:
    193
    Much appreciated ! Works on 2019.2
     
  34. guneyozsan

    guneyozsan

    Joined:
    Feb 1, 2012
    Posts:
    99
    Pure magic! Thank you. Solved for 2019.4.15f1.

    My specific error was pointing to launcher instead of gradleOut:

    A problem occurred configuring project ':launcher'.
     
  35. xuxiaonan2008

    xuxiaonan2008

    Joined:
    Aug 10, 2022
    Posts:
    1


    Thank you very much! solved for 2021.3.16f1.
    For anyone who might have the following error "Failed to read key from keystore: invalid keystore format", this answer may help!