【问题标题】:ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.legacy:legacy-support-v4:1.0.0, why?错误:无法解析“:app@debug/compileClasspath”的依赖关系:无法解析androidx.legacy:legacy-support-v4:1.0.0,为什么?
【发布时间】:2019-11-01 01:01:38
【问题描述】:

我真的不知道这个问题来自哪里,现在一直在尝试解决它。当我执行 gradle 同步时,我不断收到此错误。

错误:无法解析 ':app@debug/compileClasspath' 的依赖关系:无法解析 androidx.legacy:legacy-support-v4:1.0.0。

我什至不知道为什么我会收到一个 androidx 错误,我什至没有迁移到 androidx。这正常吗?

我执行了我在网上找到的不同修复程序,包括将我的所有依赖项更新到最新版本。下面我发布了我的应用程序和项目 gradle 文件

我的项目 gradle 文件:

buildscript {

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
//        google()
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我的应用程序 gradle 文件:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.bahdape.archangels"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.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'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    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:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.google.firebase:firebase-database:19.2.0'
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.google.firebase:firebase-storage:19.1.0'
    implementation 'com.firebaseui:firebase-ui-database:6.0.2'
    implementation'com.squareup.picasso:picasso:2.71828'
    //compile 'com.github.jgabrielfreitas:BlurImageView:1.0.1'

    // Stated Fragment
    compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'

    // Flutterwave implementation
    implementation 'com.github.Flutterwave:rave-android:1.0.40'
}

【问题讨论】:

    标签: android android-studio android-gradle-plugin build.gradle


    【解决方案1】:

    您的 firebase-ui 已移至 androidx。您可以在 gradle 中排除依赖项。

    【讨论】:

    • 感谢您的回答。但是我不理解。如果您的意思是我应该删除实现“com.firebaseui:firebase-ui-database:6.0.2”,它会影响我编写的代码。你能更好地向我解释一下吗?谢谢
    • 可能你应该降低依赖的版本或者你的项目迁移到 androidX.@henrymaykhid
    • 哦...谢谢。它确实有效。我将 firebaseui 依赖版本从 6.0.2 减少到 5.1.0。 5.1.0 版是整个 firebaseUI 代码库移至 androidx 之前发布的最后一个版本,因此使用 6.0.2 版是我在尝试同步时不断收到错误的原因。非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-27
    相关资源
    最近更新 更多