Android build miss intellij

Viewed 1927

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

3 Answers

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

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

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