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

Android Studio重构项目时无法找到exoplayer:2.11.4依赖

解决ExoPlayer 2.11.4依赖无法解析的问题

问题现象

重构Android项目时出现依赖解析失败,错误提示找不到com.google.android.exoplayer:exoplayer:2.11.4,该依赖由第三方库com.github.HamidrezaAmz:MagicalExoPlayer:1.0.16间接引入,错误日志如下:

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer:2.11.4.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
       - https://jcenter.bintray.com/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
       - https://jitpack.io/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
     Required by:
         project :app > com.github.HamidrezaAmz:MagicalExoPlayer:1.0.16

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

已尝试但无效的方法

  • 在项目根目录build.gradle中添加JitPack仓库:
allprojects {
       repositories {
            maven { url 'https://jitpack.io' }
        }
    }
  • 添加多个第三方仓库(包含已失效的Google Bintray仓库):
allprojects {
    repositories {
        maven { url 'https://google.bintray.com/exoplayer/' }
        maven { url 'https://dl.bintray.com/android/android-tools' }
        maven { url 'https://dl.bintray.com/firebase/gradle/' }
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
        flatDir {
            dirs 'libs'
        }
    }
}

可行解决方案

方案1:替换第三方库依赖版本

查找MagicalExoPlayer的最新可用版本,选择已将ExoPlayer依赖更新到可正常获取版本(如2.16+)的版本,修改app/build.gradle中的依赖:

implementation 'com.github.HamidrezaAmz:MagicalExoPlayer:最新可用版本号'

方案2:添加包含旧版ExoPlayer的镜像仓库

由于原Bintray仓库已关闭,可添加阿里云Maven镜像仓库(该镜像缓存了旧版ExoPlayer包),修改根目录build.gradle:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.aliyun.com/repository/public/' }
        maven { url 'https://jitpack.io' }
        flatDir {
            dirs 'libs'
        }
    }
}

添加后点击Sync Now重新同步项目。

方案3:本地依赖ExoPlayer包

  1. 手动下载exoplayer-2.11.4.aar包;
  2. 将包复制到项目app/libs目录下;
  3. 在app/build.gradle中添加本地依赖:
implementation files('libs/exoplayer-2.11.4.aar')

同步项目即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 16:57:42