implementation 'com.github.PicnicSupermarket:FingerPaintView:1.2'
-
在 Android 开发中,引入上述依赖出现如下错误信息
FAILURE: Build completed with 13 failures.
1: Task failed with an exception.
- What went wrong:
Execution failed for task ':drawboard:checkDebugAarMetadata'.
Could not resolve all files for configuration ':drawboard:debugRuntimeClasspath'.
Could not find com.github.PicnicSupermarket:FingerPaintView:1.2.
Searched in the following locations:
- https://maven.aliyun.com/repository/public/com/github/PicnicSupermarket/FingerPaintView/1.2/FingerPaintView-1.2.pom
- https://dl.google.com/dl/android/maven2/com/github/PicnicSupermarket/FingerPaintView/1.2/FingerPaintView-1.2.pom
- https://repo.maven.apache.org/maven2/com/github/PicnicSupermarket/FingerPaintView/1.2/FingerPaintView-1.2.pom
Required by:
project :drawboard- 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.
==============================================================================...
- What went wrong:
问题原因
-
这个错误表示项目引入的依赖 FingerPaintView 无法从当前的配置的仓库中找到,即无法从阿里云 Maven 仓库、Google Maven 仓库、Maven Central 仓库中找到
-
FingerPaintView 是一个 GitHub 上的依赖,需要在项目中添加 JitPack 仓库
-
JitPack 是专门用来拉取 GitHub(以及 GitLab、Bitbucket 等)上开源项目作为依赖的仓库服务
处理策略
- 在
settings.gradle文件中添加 JitPack 仓库
groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven { url 'https://jitpack.io' }
}
}