最近有人寄给我一个android项目进行培训。我正在学习Android,当我想构建这个项目时,它会显示以下错误信息:
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有人能帮我吗?我怎样才能解决这个问题?
发布于 2022-08-31 06:37:00
只需排除androidx遗留支持
implementation ('com.mapbox.maps:android:10.7.0') {
exclude group: 'androidx.legacy', module: 'legacy-support-core-utils'
exclude group: 'androidx.interpolator', module: 'interpolator'
}发布于 2021-10-03 18:57:02
更新你的等级,你的事情就会通过这个解决
https://stackoverflow.com/questions/68806116
复制相似问题