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

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/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar

We are having the same issue. Looks like maybe the issue is related to 2018.2.13 building

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() }

  1. 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.
2 Likes

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!

Tried it and still have the same error.
My mainTemplate.gradle buildscript looks like this:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

I also verified if the dependency was in google repository:
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/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

1 Like

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.

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 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```

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!

gdespaux2010’s solution worked for me.

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.

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).

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.

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

That sounds like a good approach @IceStormRUS though this will only work locally :frowning:
Does anyone know of a way to change the libTemplate that runs in Unity Cloud Build?

1 Like

I think this is something that need to be fixed in a new unity version…
Fore those interested :

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.

7 Likes

For me, the main issue is that the cloud build is also fails to build, and there’s no workaround for this.

1 Like

@NinjaCat Do you guys have any eta on the fix?

3 Likes

Where does gradle keep it’s jars locally? Can we just download the jar and put it in there while there’s no fix?

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?