Android Studio Failed to resolve: support-core-uti

2020-05-24 19:58发布

问题:

After upgrading support library version to 27.1.1 when i sync the project i face with below error:

Failed to resolve: support-core-utils

Any idea?

here is my project level build file:

    buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

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

and app level build file:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'

回答1:

I solved this by setting google() as first entry in allprojects/repositories in top level build.gradle

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


回答2:

as per behavior changes in android-Gradle plugin (v3.2.0 September 2018) you need to keep the google repository as the first entry

buildscript {
      repositories {
          google() // here
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.2.0'
      }
  }
  allprojects {
      repositories {
          google() // and here
          jcenter()
  }

android-Gradle plugin release note



回答3:

I have same problem and i changed to successful. Added maven { url 'https://maven.google.com' } as first entry in allprojects/repositories in top level build.gradle



回答4:

In my case , it was because of a library dependency and I solved by excluding support-core-utils from that library :

implementation ('com.github.chrisbanes:PhotoView:2.0.0'){
    exclude module: 'support-core-utils'
}


回答5:

I had the same problem with AppCompat library with version 28.0.0. I fixed it by using 28.0.0-alpha1. None of answers helped me.

Android studio 3.1.4
Target and compile sdk 28.

At the time the library was not really stable. support-core-utils is a part of android-support-v4, so if you still have a problem with that try adding
implementation 'com.android.support:support-v4:27.1.1'
to the dependencies.



回答6:

do you add implementation 'com.android.support:design:XX.X.X', implementation 'com.android.support:support-v4:XX.X.X' ? when I saw "duplicate value for resource" message I just had implementation 'com.android.support:appcompat-v7:28.0.0'

and I added implementation 'com.android.support:design:28.0.0'

implementation 'com.android.support:support-v4:28.0.0' and worked it !



回答7:

Remove mavenCentral() from repositories script in project level if there.