构建项目时出现com.arthenica:ffmpeg-kit-full:6.0-2依赖找不到的错误
构建项目时出现com.arthenica:ffmpeg-kit-full:6.0-2依赖找不到的错误
嘿,我之前也碰到过一模一样的问题!先给你还原下当时看到的错误提示,和你遇到的几乎完全一致:
> Could not find com.arthenica:ffmpeg-kit-full:6.0-2. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom - https://repo.maven.apache.org/maven2/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom - https://jcenter.bintray.com/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
其实原因很直白:这个版本的ffmpeg-kit-full并不在Android默认的那几个仓库(Google、Maven Central、JCenter)里,得专门添加它的官方仓库才行。下面是我亲测有效的解决步骤:
- 第一步:打开项目根目录下的Project级别
build.gradle(别选错成Module级的了),在allprojects的repositories块里追加ffmpeg-kit的官方仓库地址:
allprojects { repositories { google() mavenCentral() // 新增这一行 maven { url 'https://arthenica.com/repo' } } }
- 第二步:确认Module级
build.gradle里的依赖写法没有拼写错误,确保是这样的:
dependencies { // 其他依赖... implementation 'com.arthenica:ffmpeg-kit-full:6.0-2' }
- 第三步:如果还是拉取不到,试试清理Gradle缓存并强制刷新依赖,执行下面的命令:
./gradlew clean build --refresh-dependencies
按这个流程走下来,应该就能顺利拉取到这个依赖了,我当时就是这么搞定的~
备注:内容来源于stack exchange,提问作者gabocalero




