Search Unity

Builds started failing in 2 projects I've been changing, with "Could not find intellij-core.jar"

Discussion in 'Unity Cloud Build' started by faustofonseca, Oct 23, 2018.

  1. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    Since this morning I've been changing small things in 2 separate individual projects, doing completely individual changes, and they started to fail with this error. It seems this dependency is no longer accessible in the server where gradle is trying to get it.

    "A problem occurred configuring root project 'gradleOut'.
    18212: [Unity] > Could not resolve all files for configuration ':classpath'.
    18213: [Unity] > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
    18214: [Unity] Searched in the following locations:
    18215: [Unity] https://jcenter.bintray.com/com/and...intellij-core/26.0.1/intellij-core-26.0.1.jar"
     
  2. sperepel

    sperepel

    Joined:
    Jul 29, 2016
    Posts:
    14
    We are having the same issue. Looks like maybe the issue is related to 2018.2.13 building
     
  3. gdespaux2010

    gdespaux2010

    Joined:
    Feb 16, 2017
    Posts:
    7
    Here's what worked for me:

    1. Go into the **Player Settings**
    2. Under **Publishing Settings** tick the box for **Custom Gradle Template** (Unity then creates a build.gradle template for you)
    3. The template is in Assets > Plugins > Android > mainTemplate.gradle
    4. Open that file in something like Notepad
    5. Change _ONLY THIS_:

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

    6. Save the file then try the build again. Not a perfect solution but it should work until Unity/Android fixes the issue. I'm not sure whether this can become undone by upgrading Unity, but I do know that it has to be done per project.
     
    fsw and IgorTecnalia like this.
  4. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    It's worth a try. Funny enough I had just created that file to add signing to the Developer Build (google services login needs it). Thanks! I'll report back!
     
  5. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    Tried it and still have the same error.
    My mainTemplate.gradle buildscript looks like this:

    Code (CSharp):
    1. buildscript {
    2.     repositories {
    3.         google()
    4.         jcenter()
    5.     }
    6.  
    7.     dependencies {
    8.         classpath 'com.android.tools.build:gradle:3.0.1'
    9.     }
    10. }
    I also verified if the dependency was in google repository:
    "https://dl.google.com/dl/android/ma...intellij-core/26.0.1/intellij-core-26.0.1.jar"

    and it is! But gradle is still trying to get it from jcenter.

    Will continue to investigate. First I will try to understand if Cloud Build is actually using my template
     
    joy23064 likes this.
  6. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    It seems that every other library inside the plugins folder has it's own gradle file which doesn't follow the template (common_lib, native_plugins_lib, etc). So I tried to give each one it's own build.gradle file with google as the first repository, but it still doesn't work :S It also doesn't build locally like in the Cloud Build.
     
  7. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    30
    Observe same issue. The strange thing is that project builds fine on one machine, but not the other. All settings are identical for them.
    @gdespaux2010 your workaround did not work for me. After applying it I now get following error:
    > Could not resolve all files for configuration ':GoogleMobileAdsPlugin:classpath'.
    > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar
     
  8. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    This still might work. My problem is that there's a "build.gradle" file inside GooglePlayGamesManifest.plugin which overrides this change in the template. I hate the idea that I need to unpack, change that file and pack it again, just because the jcenter repository has a problem!
     
  9. echtsang

    echtsang

    Joined:
    Oct 20, 2018
    Posts:
    1
  10. calebbbarton

    calebbbarton

    Joined:
    Mar 20, 2018
    Posts:
    8
    My company is having the same issue, started mid afternoon yesterday randomly. I'll post back when I can test the suggestions in this thread.

    EDIT: gdespaux2010's solution did not work for our project. We use firebase, so it's likely overriding something. We'll just have to manually build until this is resolved.
     
    Last edited: Oct 24, 2018
  11. ffonseca

    ffonseca

    Joined:
    Jan 16, 2018
    Posts:
    1
    I think the suggested approach works. You just need to make sure that if there's any library that also needs it, you create your own gradle file there with this or else unity will generate one (the template file doesn't seem to be used for the libraries).
     
  12. ChanzDog

    ChanzDog

    Joined:
    Sep 28, 2017
    Posts:
    10
    The above approach from gdespaux2010 worked.

    Initially though, it was still throwing an error from GooglePlayGamesManifest.plugin. There ended up being another hidden build.gradle file inside the plugin (I'm on macOS). Right click the plugin and click on "Show Package Contents" and update any contained build.gradle file.

    On Windows, I am not sure how the plugin files are packaged. If it's an archive, you might want to open it with 7zip or something similar to fix the gradle files.
     
    Last edited: Oct 24, 2018
  13. IceStormRUS

    IceStormRUS

    Joined:
    Sep 13, 2016
    Posts:
    3
    gdespaux2010's solution worked only if you have not other plagins in projects.
    For each plagin Unity creates a individual build.gradle file wich make issue/ You need to change plagins' template file by path Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates\libTemplate.gradle (in Unity editor folder) to fix whole problem
     
  14. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    16
    That sounds like a good approach @IceStormRUS though this will only work locally :(
    Does anyone know of a way to change the libTemplate that runs in Unity Cloud Build?
     
    migs_pixi likes this.
  15. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    67
  16. NinjaCat

    NinjaCat

    R&D Minion Unity Technologies

    Joined:
    Aug 22, 2013
    Posts:
    69
    Hi. The issue happens when the intellij-core-26.0.1.jar hasn't been cached locally by gradle. It then tries to download the artifact from jcenter and fails - so it might not affect every machine.

    We're working on this.
     
    fsw, GainfulSage, veevoogames and 4 others like this.
  17. migs_pixi

    migs_pixi

    Joined:
    Aug 22, 2018
    Posts:
    3
    For me, the main issue is that the cloud build is also fails to build, and there's no workaround for this.
     
    eladleb4 likes this.
  18. sperepel

    sperepel

    Joined:
    Jul 29, 2016
    Posts:
    14
    @NinjaCat Do you guys have any eta on the fix?
     
  19. abeldantas

    abeldantas

    Joined:
    Jul 28, 2013
    Posts:
    14
    Where does gradle keep it's jars locally? Can we just download the jar and put it in there while there's no fix?
     
  20. faustofonseca

    faustofonseca

    Joined:
    Oct 19, 2013
    Posts:
    10
    Still having the issue. I would imagine this would be simple to fix by placing the file in "jcenter". Who runs it? And why does gradle think it has it? Shouldn't it just fallback to google repository?
     
  21. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    30
    For Windows I have found it in:
    C:\Users\YOUR_USER\.gradle\caches\modules-2\files-2.1\com.android.tools.external.com-intellij\intellij-core\26.0.1\a373ed549821cb9a932b87c79792790f6d018727\intellij-core-26.0.1.jar

    Apparently its presence in cache does not help to solve the problem.
     
  22. Bestlis

    Bestlis

    Joined:
    Jan 15, 2014
    Posts:
    27
    I export project to Android Project and discovered that another library has own gradle files. For example ChartboostSDK and GoogleMobileAdsPlugin. In that file repositories is on wron order:
    repositories {
    jcenter()
    google()
    }

    When I change it ot
    repositories {
    google()
    jcenter()
    }
    it works fine.

    Question: How I can change it without exporting to Android Project?
     
  23. mentalup

    mentalup

    Joined:
    Dec 14, 2017
    Posts:
    1
    It does not work for us even we export the project and change the repository placement. Any other solutions?
     
  24. Bestlis

    Bestlis

    Joined:
    Jan 15, 2014
    Posts:
    27
    Have you changed in all .gradle files?
     
  25. konyavic

    konyavic

    Joined:
    Jan 19, 2015
    Posts:
    1
    We fixed by changing the build.gradle files under the root and unity-android-resources/ in the exported project tree. Also we had to execute 'gradle wrapper' and set the gradle version to 4.6 in 'gradle/wrapper/gradle-wrapper.properties' in case the local gradle version is not proper.
     
  26. abeldantas

    abeldantas

    Joined:
    Jul 28, 2013
    Posts:
    14
    So you're exporting the project to android studio and changing the the build.gradle files with the fix and you're also changing the gradle version, and building the game there. Is that it?

    Any idea on how to do this without having to export the project, just by building normally?

    One thing I noticed is that on the project root, under the Temp/gradleOut/ folder there are 2 build.gradle files.
    One matches the custom gradle template I made. And the other is under the folder of the plugin (Firebase in my case), and does not match the template.

    All the custom template has is google() before jcenter() - the jar from jcenter seems to be bugged.

    This is basically the same that @Bestlis said

    So the problem seems to be that we don't have a way to edit the build.gradle for these libraries we're using.
     
  27. NinjaCat

    NinjaCat

    R&D Minion Unity Technologies

    Joined:
    Aug 22, 2013
    Posts:
    69
  28. abeldantas

    abeldantas

    Joined:
    Jul 28, 2013
    Posts:
    14
    Thanks @NinjaCat ! That's exactly what I wanted, the steps in that thread worked in editing the gradle file for Firebase. And I can now build normally via the Editor.

    It still seemed to be buggy without that change. I will trigger a clean cloudbuild build and see if it still fails.
     
  29. abeldantas

    abeldantas

    Joined:
    Jul 28, 2013
    Posts:
    14
    Cloudbuild is still failing. But I'm guessing they will fix the jar on jcenter soon, so that's not a big deal since it is possible to build the project locally.
     
  30. Bestlis

    Bestlis

    Joined:
    Jan 15, 2014
    Posts:
    27
    I change order for libTemplate.gradle nad now I get another error:

    A problem occurred evaluating root project 'gradleOut'.
    > Failed to apply plugin [id 'com.android.application']
    > Minimum supported Gradle version is 4.6. Current version is 4.2.1. If using the gradle wrapper, try editing the distributionUrl in D:\UnityProjects_5\NetWalk\Temp\gradleOut\gradle\wrapper\gradle-wrapper.properties to gradle-4.6-all.zip

    When I change gradle version to 4.2.1 I get error:

    A problem occurred configuring root project 'gradleOut'.
    > Could not resolve all files for configuration ':classpath'.
    > Could not find com.android.tools.build:gradle:4.2.1.

    Any ideas?
     
  31. daniel-hall

    daniel-hall

    Joined:
    Sep 14, 2015
    Posts:
    2
    You can do a workaround on cloud build by adding another gradle build file for any libraries that need the swap. I added a modified libTemplate.gradle to my Plugins/Android/Firebase folder.

    It's not ideal long term, and I had to hard code my sdk versions and match the cloud build tools versions with trial and error. I'm sure a proper fix won't be long though so I didn't think it was worth making a more robust attempt.

    Code (csharp):
    1.  
    2. /*
    3. Gradle build file adapted from libTemplate.gradle found in the Unity editor at filepath:
    4. Unity⁩/⁨Hub⁩/⁨Editor⁩/2018.2.11f1⁩/⁨PlaybackEngines⁩/⁨AndroidPlayer⁩⁨/Tools⁩/GradleTemplates⁩
    5. Modification was required to import the google repository before jcenter.
    6. */
    7.  
    8. buildscript {
    9.     repositories {
    10.         google()
    11.         jcenter()
    12.     }
    13.     dependencies {
    14.         classpath 'com.android.tools.build:gradle:3.0.1'
    15.     }
    16. }
    17.  
    18. apply plugin: 'android-library'
    19.  
    20. dependencies {
    21.     implementation fileTree(dir: 'bin', include: ['*.jar'])
    22.     implementation fileTree(dir: 'libs', include: ['*.jar'])
    23. }
    24.  
    25. android {
    26.     sourceSets {
    27.         main {
    28.             manifest.srcFile 'AndroidManifest.xml'
    29.             res.srcDirs = ['res']
    30.             assets.srcDirs = ['assets']
    31.             jniLibs.srcDirs = ['libs']
    32.         }
    33.     }
    34.  
    35.     //TODO: These values should ideally be taken from ProjectSettings instead of being hard coded
    36.     compileSdkVersion 27
    37.     buildToolsVersion '27.0.1'
    38.  
    39.     defaultConfig {
    40.         minSdkVersion 19
    41.         targetSdkVersion 27
    42.     }
    43.  
    44.     lintOptions {
    45.         abortOnError false
    46.     }
    47. }
    48.  
     
    abeldantas and thibouf like this.
  32. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    323
    If you do edit the gradle template with custom, make sure you remove the Unity generated comment at the top of the file or it will auto-generate the changes back to default.
     
  33. ollieblanks

    ollieblanks

    Unity Technologies

    Joined:
    Aug 21, 2017
    Posts:
    165
    To workaround this issue:

    1. Go to Player Settings
    2. Under Publishing Settings tick the box for Custom Gradle Template (Unity then creates a mainTemplate.gradle file for you)
    3. Open that file in a text editor and swap the repositories so that google() is above jcenter() under buildscript repositories (This step will resolve the issue at Project level)

    Code (CSharp):
    1. buildscript {
    2.     repositories {
    3.         google()
    4.         jcenter()
    5.     }
    4. Add google() to the top of allprojects repositories (This step will resolve the issue for Firebase or any other plugins)

    Code (CSharp):
    1. allprojects {
    2.     repositories {
    3.         google()
    4.         flatDir {
    5.             dirs 'libs'
    6.         }
    7.     }
    8. }
    5. Commit the new mainTemplate.gradle file and the changes made to the ProjectSettings.asset file to your repository
     
    Novack likes this.
  34. Bestlis

    Bestlis

    Joined:
    Jan 15, 2014
    Posts:
    27
    Fixed!

    Set gradle to com.android.tools.build:gradle:3.0.1 and Forse Resolve PlayServiceResolver.
    After build success.
     
  35. sperepel

    sperepel

    Joined:
    Jul 29, 2016
    Posts:
    14
  36. NamekGames

    NamekGames

    Joined:
    May 13, 2014
    Posts:
    9
    How do you do it with manual build? I dont use the cloud build feature and still have the same problem.
     
  37. NamekGames

    NamekGames

    Joined:
    May 13, 2014
    Posts:
    9
    This is not true at all, the error is still the same after adding google() before everything in allproject repositories. Same error. I am working with firebase also.
     
  38. sperepel

    sperepel

    Joined:
    Jul 29, 2016
    Posts:
    14
    Looks like the cloud build is fixed not!! Good job guys!
     
  39. Vladyslav-Khromykh

    Vladyslav-Khromykh

    Joined:
    Oct 23, 2018
    Posts:
    1
    So, what is the really proper solution for that?
    Change libTemplate in Unity internal folder or gradletemplate in project?
    Which of it fixes cloud build?
     
  40. NamekGames

    NamekGames

    Joined:
    May 13, 2014
    Posts:
    9
  41. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    20
    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!
     
  42. gamingsauce

    gamingsauce

    Joined:
    Apr 21, 2018
    Posts:
    2
    Please tell me where is that .gradle folder T.T I cannot find it
     
  43. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    20
    It is inside C drive
    C:\Users\USER_NAME