You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法关联GitHub依赖库,多个Android依赖解析失败求助

依赖解析失败问题排查与解决

问题现象

构建项目时出现以下依赖解析失败错误:

Failed to resolve: com.jcodecraeer:xrecyclerview:1.6.0
Failed to resolve: com.github.smarteist:autoimageslider:1.1.1
Failed to resolve: com.android.volley:volley:1.1.1
Failed to resolve: com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-java:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-x86:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8

用户当前配置文件如下:

app/build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 34
namespace "com.androworld.player.video_player"
defaultConfig {
    applicationId "com.androworld.player.video_player"
    minSdkVersion 21
    targetSdkVersion 34
    versionCode 40
    versionName "4.2.8"
    multiDexEnabled true
    ndk {
        // config you want to support device
        abiFilters 'arm64-v8a', 'armeabi', 'armeabi-v7a', 'x86'
    }
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    debugMini {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
configurations.all {
    resolutionStrategy {
        force 'androidx.annotation:annotation:1.2.0'
    }
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '28.0.0'
            }

        }

    }

}

//    sourceSets.main {
//        jniLibs.srcDirs 'src/main/libs'
//    }

}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
//implementation 'androidx.annotation:annotation:1.2.0'
//implementation 'androidx.annotation:annotation-jvm:1.7.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
//support
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.jcodecraeer:xrecyclerview:1.6.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
//vector,percent,palette
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
//equlizer
implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
implementation 'com.joanzapata.iconify:android-iconify-entypo:2.2.2'
//    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

implementation 'com.github.smarteist:autoimageslider:1.1.1'
//data
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'org.apache.commons:commons-io:1.3.2'
//youtubeplayer
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1'
//    implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'
//Ads
//implementation 'com.google.android.gms:play-services-ads:20.4.0'
//intro_screen
implementation project(':material-intro-screen')
//player
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'

//    implementation project(':ijkplayer-java')
//    implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'

//    implementation project(':xvideoplayer')
//    implementation 'com.henryblue.mxvideoplayer:xvideoplayer:1.2.1'
implementation 'com.firebase:firebase-client-android:2.5.0'
implementation 'com.yandex.android:mobileads:5.10.0'
implementation 'com.yandex.android:mobmetricalib:5.0.0'
//implementation 'com.google.android.gms:play-services-ads:17.2.1'

//implementation 'com.facebook.android:audience-network-sdk:5.3.0'

implementation 'androidx.work:work-runtime-ktx:2.7.1' //no started android api 32
}

settings.gradle

pluginManagement {
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
    maven { url "https://www.jitpack.io" }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    jcenter() // Note: JCenter is deprecated and should be avoided if possible
    maven { url "https://www.jitpack.io" }
    maven {
        url "https://artifactory-external.vkpartner.ru/artifactory/maven"
    }
    maven { url 'https://dl.bintray.com/yandexmobile/maven' } // Likely deprecated, use 
alternatives
    maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven- 
repository/" }
    maven { url "https://dl.bintray.com/theartofdev/Edmodo" } // Deprecated
}
}

include ':app', ':material-intro-screen'

解决方案

1. 清理废弃仓库,补充必要仓库

修改settings.gradle,移除已停止服务的仓库(如JCenter、Bintray相关),补充稳定的镜像仓库:

pluginManagement {
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
    maven { url "https://www.jitpack.io" }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    maven { url "https://www.jitpack.io" }
    maven { url "https://maven.aliyun.com/repository/public" }
}
}

include ':app', ':material-intro-screen'

2. 替换无法解析的依赖坐标/版本

修改app/build.gradle中的依赖,替换部分已迁移或停止维护的库:

dependencies {
// ... 保留原有其他依赖 ...

// 替换xRecyclerView为Jitpack上的可用坐标
implementation 'com.github.jcodecraeer:XRecyclerView:v1.6.0'
// 替换AutoImageSlider为Jitpack上的可用版本
implementation 'com.github.Smarteist:autoimageslider:1.1.1'
// Volley更新到Google官方维护的最新兼容版本
implementation 'com.android.volley:volley:1.2.1'
// YouTubePlayer更新到兼容的稳定版本
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'
// ijkplayer改用Jitpack上的预编译全架构版本,无需单独引入ABI依赖
implementation 'com.github.Bilibili:ijkplayer:0.8.8'

// ... 保留原有其他依赖 ...
}

3. 调整NDK架构配置

移除已废弃的armeabi架构,修改defaultConfig中的ndk配置:

ndk {
    abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}

4. 清理缓存并同步项目

  • 执行File > Invalidate Caches... > Invalidate and Restart重启Android Studio
  • 点击右上角Sync Project with Gradle Files按钮重新同步项目

完成以上步骤后,依赖解析失败的问题即可解决。

内容的提问来源于stack exchange,提问作者EugeneSermyagin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 15:37:02