赞
踩
编译 Android Studio 项目时 , 报如下错误 , 下载依赖库失败 ;
报错信息 :
Execution failed for task ':ijkplayer-exo:generateDebugRFile'.
> Could not resolve all files for configuration ':ijkplayer-exo:debugCompileClasspath'.
> Could not resolve com.google.android.exoplayer:exoplayer:r1.5.11.
Required by:
project :ijkplayer-exo
> Could not resolve com.google.android.exoplayer:exoplayer:r1.5.11.
> Could not get resource 'https://raw.githubusercontent.com/Pgyer/analytics/master/com/google/android/exoplayer/exoplayer/r1.5.11/exoplayer-r1.5.11.pom'.
> Could not HEAD 'https://raw.githubusercontent.com/Pgyer/analytics/master/com/google/android/exoplayer/exoplayer/r1.5.11/exoplayer-r1.5.11.pom'.
> raw.githubusercontent.com
* 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.
Gradle 下载 依赖库 出现问题 , 按照下面的步骤 进行操作检查 ;
ExoPlayer 是 Google 提供的一个在 Android 平台上的媒体播放器 , 它支持多种媒体格式和流媒体协议 ;
ijkplayer-exo 是 BliBli 对 Google 的 ExoPlayer 播放器的封装 , 通过封装 ExoPlayer,ijkplayer-exo 使得开发者能够在使用 ijkplayer 框架的同时,也能利用 ExoPlayer 的特性和功能 ;
通过在网络上进行搜索 , 确定 com.google.android.exoplayer:exoplayer 软件包是否存在 , 这是 https://github.com/google/ExoPlayer 的 GitHub 地址 ;
上述报错信息是 " Could not resolve com.google.android.exoplayer:exoplayer:r1.5.11. " 下载失败 , 这里就要确认 r1.5.11 版本号是否存在 ;
到 https://github.com/google/ExoPlayer/tags 页面 , 确认版本号是否存在 ;
确保配置的 Maven 仓库地址正确 ;
在 根目录下的 build.gradle 文件中配置的 allprojects / repositories 配置 就是 Maven 仓库地址 , 比如 jcenter() 或 mavenCentral() , 以便 Gradle 下载依赖时 , 从这些仓库中下载 ;
allprojects {
repositories {
google()
mavenCentral()
}
}
在本案例中 , 添加了 ijkplayer 仓库 , 解决了上述问题 ;
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// ijkplayer 仓库
maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://repository.mulesoft.org/nexus/content/repositories/public/" }
maven { url "https://dl.bintray.com/bilibili/maven/" }
}
}
检查网络 ,
参考 下一篇博客 【错误记录】Android 编译报错 ( Could not resolve xxx | 手动下载依赖库并进行本地配置 Gradle 依赖的解决方案 ) ;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。