旧git依赖没有迁移到jitpack导致的导入异常

报错日志

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:dataBindingMergeDependencyArtifactsDebug’.

Could not resolve all files for configuration ‘:app:debugCompileClasspath’.
Could not find com.baoyz.swipemenulistview:library:1.3.0.
Required by:
project :app

  • 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.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeDebugResources’.

Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
Could not find com.baoyz.swipemenulistview:library:1.3.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/baoyz/swipemenulistview/library/1.3.0/library-1.3.0.pom
- https://repo.maven.apache.org/maven2/com/baoyz/swipemenulistview/library/1.3.0/library-1.3.0.pom
- https://jitpack.io/com/baoyz/swipemenulistview/library/1.3.0/library-1.3.0.pom
Required by:
project :app

描述:在github中还有,但是没有迁移到jitpack

解决办法

如果 com.baoyz.swipemenulistview:library:1.3.0 在 GitHub 上存在,但是没有在 JitPack 上发布,你可以通过手动集成这个库的方式解决问题。

手动集成 swipemenulistview

步骤 1:下载源码或 .aar 文件
  1. 从 GitHub 克隆或下载源码

  2. 打包 .aar 文件(如果下载的是源码):

    • 如果你下载了源码,你可以通过 ./gradlew build 命令打包生成 .aar 文件。
    • 生成的 .aar 文件通常会在 library/build/outputs/aar/ 目录下。
步骤 2:将 .aar 文件添加到项目
  1. 创建一个 libs 目录(如果不存在):

    • 在你的 app 模块目录下,创建一个 libs 文件夹。
  2. 将下载或构建好的 .aar 文件放入 libs 目录中。

步骤 3:在 build.gradle 中引用 .aar 文件

app/build.gradle 文件的 dependencies 部分中添加以下内容来引用本地的 .aar 文件:

implementation files('libs/swipemenulistview-1.3.0.aar')

如果你还使用其他库,也可以通过相同方式集成。

备选方案:通过 Git Submodule 或手动引入源码

如果不想手动打包 .aar,可以将库的源码直接引入到项目中:

  1. 使用 Git Submodule

    • 你可以将 SwipeMenuListView 仓库作为 Git Submodule 添加到你的项目中,然后在项目中直接引用它。
    git submodule add https://github.com/baoyongzhang/SwipeMenuListView.git
    
  2. 直接复制源码

    • 下载该库的源码并将其作为一个模块添加到你的项目中,或者直接复制 SwipeMenuListViewlibrary/src 代码到你的项目里。
步骤 4:同步项目并构建

执行 Gradle 同步,确保所有依赖项都能正确加载:

./gradlew build

通过这种方式,你可以避免 JitPack 上无法找到的依赖问题,同时将库正常集成到项目中。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值