【问题标题】:Unable to resolve dependency for... after update android studio from 3.4 to 3.5将 android studio 从 3.4 更新到 3.5 后无法解决...
【发布时间】:2019-08-22 03:58:10
【问题描述】:

今天,android studio 的更新从 3.4 版本到 3.5 版本。使用 3.4 版时,一切正常,而在 3.5 版开始时,我在 circleimageview 库的项目中发现错误。就是这样

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve de.hdodenhof:circleimageview:3.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve de.hdodenhof:circleimageview:3.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve junit:junit:4.12.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.squareup:javawriter:2.1.1.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve org.hamcrest:hamcrest-library:1.3.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve org.hamcrest:hamcrest-integration:1.3.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:2.0.1.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve de.hdodenhof:circleimageview:3.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve junit:junit:4.12.
Show Details
Affected Modules: app

这是我的 build.gradle 文件(模块:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.uni.project"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    //circle imageview
    implementation 'de.hdodenhof:circleimageview:3.0.0'
}

我真的不知道出了什么问题,我该如何解决?既然这个项目很重要,有没有办法回到 3.4 版?

【问题讨论】:

  • 试试这个---> 转到重构菜单 -> 从菜单栏迁移到 AndroidX。
  • 你可以点击Show Details看看它说了什么吗?
  • 感谢您的回答我没有尝试这个解决方案,我只是重新同步了项目并且它工作了
  • 简单地重新同步也对我有用。

标签: android android-studio dependencies


【解决方案1】:

我看到 CircleImageView 使用 AndroidX underneath。尝试将您的项目迁移到 AndroidX

【讨论】:

  • 刚刚在我的项目上进行了测试,并且通过实现 'de.hdodenhof:circleimageview:3.0.0' 和 AndroidX 构建成功
  • 感谢您的回答我没有尝试这个解决方案,我只是重新同步了项目并且它工作了
【解决方案2】:

对我来说,buildType 是问题所在。我删除了它,进行了 Gradle 同步,构建了应用程序并再次添加了它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-13
    • 1970-01-01
    • 2010-11-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多