Android Studio - Could not find intellij-core.jar

折月煮酒 提交于 2019-11-27 12:33:59

I was able to fix the issue by changing the order of the repositories here:

/platforms/android/CordovaLib/build.gradle

from this:

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

to this:

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

If you're using classpath 'com.android.tools.build:gradle:3.0.1' or higher in your project/build.gradle, the solution is:

Add "google()" to your project/build.gradle file in 2 places:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        ...
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

Then you will see in the logs that intellij-core.jar is downloaded from different URLs:

To resolve this issue either put

<preference name="android-targetSdkVersion" value="27" />

into your config.xml.

Or even better, upgrade android-cordova to the lates version (7.1.2):

cordova platform add android@7.1.2

android-cordova 7.1.2 includes fix CB-14127: "Move google maven repo ahead of jcenter". (https://issues.apache.org/jira/browse/CB-14127)

Costas Bakoulias

I solve my problem; change the platform/android/CordovaLib/build.gradle file. I put the maven repo ahead the jcenter:

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

}

And I use cordova-android 7.1.1.

hey guys I came across the same problem, which is actually a conflict between the ionic, gradle and gradle plugin. It turns out that in the new version of the gradle plugin the build is now dependent on the google repository. To get around the problem you need to change 2 files:

Make sure they are as described below!

1 ° - “platforms / android / CordovaLib / build.gradle”

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

2 ° - “platforms / android / build.gradle”

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

and

 allprojects {
  repositories {
  google()
  maven {
   url “https://maven.google.com”
  }
  jcenter ()
 }

This is it. Hope this helps!

https://github.com/flutter/flutter/pull/23397

In short, following Mahi-K from the above link, you have to edit $flutterRoot/packages/flutter_tools/gradle/flutter.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

In the gradle wrapper properties gradle/wrapper/gradle-wrapper.properties you may also have to change it to 4.6 or above

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

Use com.android.tools.build:gradle:3.2.1

You'll also have to update your '/gradle/wrapper/gradle-wrapper.properties'

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

For me, problem solved change build gradle files to get Google Server.
/platforms/android/build.gradle

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

/platforms/android/app/build.gradle

allprojects {
    repositories {
        google()
        mavenCentral();
        jcenter()
    }

Adding google() to the build.gradle files uses this URL https://dl.google.com/dl/android/maven2/ which returns 404 at the moment.

(source: https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/dsl/RepositoryHandler.html#google--)

At the moment, the working URL is https://dl.google.com/dl/android/maven2/index.html You can reach it by replacing google() with this line

maven { url 'https://maven.google.com' }

in your build.gradle files.

This issue is being tracked on Jira

A break down of the issue

Basically there was a problem uploading Google jars to jcenter and it is causing builds to fail.

The fix

Builds will work if we put the google maven repo ahead of jcenter.

On the 18th July the issue should have been addressed in the release of cordova-android 7.1.1, see change log here

The fix however did not work in all cases evidently.

A new fix has been made so expect this to be ready in 7.1.2, until then, remember to swap the ordering every time you remove and re-add the platform.

nkhar

In addition to devsnd and Mr-IDE's answers, Here are the suggestions:

  • Place 'google()' in the first order in both buildscript repositories and allprojects repositories of Project-level Gradle build file.

  • Check the consistency in the Android Gradle Plugin version and Gradle version. Generally, they are automatically updated with Android Studio, but you might have an older project. Plugin 3.1 should use Gradle version 4.4 and above, Plugin 3.2 should use Gradle version 4.6 and above.

  • Install that particular buildToolsVersion that plugin uses.

Check out this link for more details:

https://developer.android.com/studio/releases/gradle-plugin#updating-gradle

Hope this helps.

Downgrading to:

com.android.tools.build:gradle:3.1.0

form

com.android.tools.build:gradle:3.2.1

Solved the Problem

also: i put google() at first

I'm using Android Studio 3.2.1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!