首页 > 解决方案 > Android Studio:找不到 legacy-support-core-utils-1.0.0.jar

问题描述

最近有人给我发了一个 android 项目进行培训。我正在学习 Android Studio,当我想构建这个项目时,它会显示以下错误消息:

Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':app:debugCompileClasspath'.
   > Could not find legacy-support-core-utils-1.0.0.jar (androidx.legacy:legacy-support-core-utils:1.0.0).
     Searched in the following locations:
         https://maven.google.com/androidx/legacy/legacy-support-core-utils/1.0.0/legacy-support-core-utils-1.0.0.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

我在任何存储库中搜索legacy-support-core-utils-1.0.0.jar并找不到它。这是我第一次看到这个问题!

这些是我的依赖项:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.android.volley:volley:1.2.0'
    implementation platform('com.google.firebase:firebase-bom:28.2.0')
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-database'
    implementation 'com.google.firebase:firebase-storage'
    implementation 'com.facebook.android:facebook-android-sdk:5.15.3'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.hbb20:ccp:2.5.3'
    implementation 'com.google.android.gms:play-services-auth:19.0.0'
    implementation 'com.google.android.play:core:1.10.0'
    implementation 'com.google.android.gms:play-services-ads:20.2.0'
    implementation 'com.github.CanHub:Android-Image-Cropper:3.1.2'
    implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
    implementation 'com.android.billingclient:billing:3.0.1'
    implementation "androidx.preference:preference:1.1.1"

    implementation 'org.jetbrains:annotations:15.0'
    def lifecycle_version = "2.0.0"
    //noinspection GradleDependency
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    //noinspection GradleDependency
    implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
    //noinspection LifecycleAnnotationProcessorWithJava8
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
    implementation('io.jsonwebtoken:jjwt:0.9.1')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
}
apply plugin: 'com.google.gms.google-services'

还有我在 build.gradle 中的存储库:

buildscript {
    repositories {
        mavenCentral()
        maven {
            url 'https://mvnrepository.com/'
        }
        maven { url "https://jitpack.io" }
        maven { url "https://android.googlesource.com/" }
        maven { url "https://maven.fabric.io/public" }
        maven { url "https://raw.githubusercontent.com/2br-2b/Fdroid-repo/master/fdroid/repo/" }
        maven { url "https://mobileapp.bitwarden.com/fdroid/repo" }
        maven { url "https://fdroid.bromite.org/fdroid/repo/" }
        maven { url "https://fdroid.bromite.org/fdroid/repo/" }
        maven {
            url 'https://maven.fabric.io/public'
        }
        maven {
            url 'https://maven.google.com'
        }
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath 'com.google.gms:google-services:4.3.5'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        mavenCentral()
        maven {
            url 'https://mvnrepository.com/'
        }
        maven { url "https://jitpack.io" }
        maven { url "https://android.googlesource.com/" }
        maven { url "https://maven.fabric.io/public" }
        maven { url "https://raw.githubusercontent.com/2br-2b/Fdroid-repo/master/fdroid/repo/" }
        maven { url "https://mobileapp.bitwarden.com/fdroid/repo" }
        maven { url "https://fdroid.bromite.org/fdroid/repo/" }
        maven { url "https://fdroid.bromite.org/fdroid/repo/" }
        maven {
            url 'https://maven.fabric.io/public'
        }
        maven {
            url 'https://maven.google.com'
        }
        google()
        jcenter()
    }
}

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

还有我的gradle-wrapper.properties文件:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

有人可以帮我解决这个问题吗?我该如何解决这个问题?

标签: javaandroidandroid-studio

解决方案


更新您的 Gradle,您的问题将由此解决


推荐阅读