4

since today I cannot build my android project because of this error :

> Could not resolve all files for configuration ':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

Android studio 3.2.1 com.android.tools.build:gradle:3.0.1

Do you have any clue ??? Thanks a lot

Vlad

Jolta
  • 2,620
  • 1
  • 29
  • 42
Vladmotard
  • 41
  • 3
  • same here, and over there https://stackoverflow.com/questions/52946371/android-studio-could-not-find-intellij-core-jar – Pierre Yves Oct 23 '18 at 10:31
  • where should I put those files (https://mvnrepository.com/artifact/com.android.tools.external.com-intellij/intellij-core/26.0.1) in order to be able to build again ? – Vladmotard Oct 23 '18 at 10:43

3 Answers3

4

I had the same problem with a cordova-android@7.1.1 project. I read this question Android Studio - Could not find intellij-core.jar and I solved by joining more than one answer.

Premise:

  • Android Studio 3.2.1
  • Cordova Android 7.1.1
  • Cordova Cli 8.1.2

Resolution:

File: platforms/android/build.gradle

...
buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
...

File: platforms/android/app/build.gradle

...
buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

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

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}
...

File: platforms/android/CordovaLib/build.gradle

...
buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    }
}
...

This solution is working to me, I hope I helped you

Michele Belluco
  • 41
  • 1
  • 2
  • 5
  • Anyone familiar with a plugin / hook to do this, as my problem is on my CI server? – Tally Barak Oct 24 '18 at 13:00
  • I think writing a hook for this problem is very expensive. There is already a pull request to solve this problem https://github.com/apache/cordova-android/pull/525. We hope they will release an update as soon as possible. – Michele Belluco Oct 24 '18 at 13:34
0

I have the same issues, and change to classpath 'com.android.tools.build:gradle:3.1.0' solve my issues. You can try it.

0

This answer is heavily based on the ionic article: https://ionic.zendesk.com/hc/en-us/articles/360005529314

This script can be added to the hooks so no need to fiddle with the platforms code manually.

Create a maven_swap.sh with the following:

#!/bin/bash

#remove jcenter
sed -i.bak '/jcenter()/d' platforms/android/CordovaLib/build.gradle
#append jcenter
sed -i.bak  '/maven {/{
N
N
a\
jcenter()
}' platforms/android/CordovaLib/build.gradle
cat platforms/android/CordovaLib/build.gradle
rm platforms/android/CordovaLib/build.gradle.bak

note: sed -i.bak ensures linux & mac compatibility.

Make sure the file is executable chmod +x maven_swap.sh

Add in the config.xml the following:

<platform name="android">
    <hook src="maven_swap.sh" type="before_compile" />
    ...
</platform>
Tally Barak
  • 282
  • 4
  • 11