Failed to resolve: support-core-utils

(直接从必应翻译过来,我的问题样已经解决,有几种方案)

将支持库版本升级到27.1.1后我同步项目我遇到以下错误:

Failed to resolve: support-core-utils

任何的想法?

这是我的项目级构建文件:

    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" }
    }
}

和应用程序级别构建文件:

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'

答案

我通过将google()设置为顶级build.gradle中allprojects / repositories中的第一个条目来解决这个问题

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

投票5投票

我有同样的问题,我改为成功。添加maven { url 'https://maven.google.com' }作为顶级所有项目/存储库中的第一个条目build.gradle

 

  • 虽然它已经存在于OP。google()是谷歌回购 -  佐伊 5月29日7:30

  • 这个问题有什么进展吗?我有同样的问题 -  Mysterious_android 6月6日4:18

  • 1

    改变顺序确实对我有用。任何解释? -  Jantzilla 6月7日21:27

  • 这对我也有用,谢谢你的回答。对这个无意义的bug感到羞耻。 -  SerdarSamancıoğlu 10月31日10:53 

  • 也为我工作...... -  Rehan Raza 11月2日19:48

投票3投票接受

在我的例子中,这是因为库依赖,我通过从该库中排除support-core-utils来解决:

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

投票0投票

我对AppCompat版本库有同样的问题28.0.0。我用它来修复它28.0.0-alpha1。答案都没有帮助我。

Android studio 3.1.4 
定位并编译sdk 28

这个问题可能是由于你的项目中使用了过时的 Android Support Library 而导致的。在最新版本的 Android Gradle 插件中,Google 已经将 Android Support Library 替换为 AndroidX。因此,你需要将你的项目迁移到 AndroidX。 要迁移到 AndroidX,你可以使用 Android Studio 中的 Refactor 工具。具体步骤如下: 1. 打开你的项目,在菜单栏中选择 Refactor -> Migrate to AndroidX。 2. 在弹出的对话框中,选择要迁移的项目和模块,然后点击 Refactor。 3. Android Studio 将会自动为你的项目更改所有依赖项和类引用,以使它们指向新的 AndroidX 库。 4. 如果 Refactor 过程中出现任何问题,你可以手动更改你的 build.gradle 文件,以使用 AndroidX 库。在 build.gradle 文件中添加以下代码: ``` android { ... defaultConfig { ... // 增加以下两行 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" android.useAndroidX=true } // 增加以下两行 configurations.all { resolutionStrategy { force 'com.android.support:support-v4:28.0.0' // 使用 28.0.0 版本的 support-v4 库 } } } // 移除以下两行 // implementation 'com.android.support:support-v4:28.0.0' // implementation 'com.android.support:appcompat-v7:28.0.0' // 增加以下两行 implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' ``` 5. 最后,点击菜单栏中的 Build -> Clean Project,等待清除完成后再点击 Build -> Rebuild Project,重新构建你的项目。 如果你还遇到其他问题,请参考 Google 的官方文档:[Migrating to AndroidX](https://developer.android.com/jetpack/androidx/migrate)。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值