AndroidStudio 依赖的包文件导入失败

**AndroidStudio依赖的包导入失败 **Could not resolve com.github.xxx

公司的项目从仓库中拉取下来,报错,依赖包无法导入

Execution failed for task ':common:generateDebugRFile'.
> Could not resolve all files for configuration ':common:debugCompileClasspath'.
   > Could not find com.github.giswangsj:AndRatingBar:1.0.5.
     Required by:
         project :common
   > Could not find com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.3-jitpack.
     Required by:
         project :common

Unable to resolve dependency for ':app@huaweiDebug/compileClasspath': Could not resolve com.github.giswangsj:AndRatingBar:1.0.5.
Show Details
Affected Modules: app

Unable to resolve dependency for ':app@huaweiDebugUnitTest/compileClasspath': Could not resolve com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.3-jitpack.
Show Details
Affected Modules: app

可以看到

com.github.giswangsj:AndRatingBar:1.0.5

com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.3-jitpack

这两个依赖无法导入,但是同样的代码同事的可以编译,没有问题。于是怀疑我的MA电脑的环境问题,各种排查开始了

,android studio 版本问题?gradle 插件版本?gradle、JDK 版本不行???,看了半天要吐了~~~ 都不管用。

于是新建一个项目导入以上依赖,依然报错。所以确定不是环境问题。怀疑同事电脑mave的本地缓存了以上依赖。所以他能够编译通过,这是想吐啊,------

建议:
  1. 去github上的项目看看,是否有升级的版本
  2. 仓库看看到底是否存在
仓库地址:
mavenCentral 仓库地址

Jitpack 地址

在这里插入图片描述

可以看到 AndRatingBar 根本不存在 1.0.5**,远程仓库应该已经删除了**。

在这里插入图片描述

com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.3-jitpack 8.1.3-jitpack该版本已经不存在了

错误原因:

  • 本地仓库是远程仓库的一个缓冲和子集,当你构建Maven项目的时候,首先会从本地仓库查找资源,如果没有,那么Maven会从远程仓库下载到你本地仓库。这样在你下次使用的时候就不需要从远程下载了。如果你所需要的jar包版本在本地仓库没有,而且也不存在于远程仓库,Maven在构建的时候会报错,*
  • Maven缺省的本地仓库路径为${user.home}/.m2/repository
  • Android Studio项目中添加的远程依赖的包,下载后会保存的本地缓存库,路径是:
包名\模块名\版本号\哈希值\jar或aar文件,

例:

C:\Users\用户名\.gradle\caches\modules-2\files-2.1。

mac上的路径是:/Users/xxx/.gradle/caches/modules-2/files-2.1 可以通过 访达->前往文件夹 进行访问

猜你喜欢

转载自blog.csdn.net/MrLizuo/article/details/124076788