【问题标题】:Can't add dependency from library with suffix HEAD-SNAPSHOT无法从带有后缀 HEAD-SNAPSHOT 的库中添加依赖项
【发布时间】:2021-09-28 16:24:31
【问题描述】:

我正在关注一个 GitHub 项目示例,其中用户在 build.gradle 文件中添加了一个库依赖项。他们有依赖关系

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3''

    implementation 'org.xrpl:xrpl4j-client:HEAD-SNAPSHOT'
    implementation 'org.xrpl:xrpl4j-keypairs:HEAD-SNAPSHOT'
}

我尝试将相同的依赖项添加到我的项目中,但最后两个依赖项导致 Gradle 项目无法同步。

我在尝试导入这两个依赖项时到底做错了什么?

唯一的区别是我的项目是基于 java 的,而 GitHub 示例是基于 kotlin 的,但这应该没什么区别吧?因为我要导入的库是用于 Java 的。

【问题讨论】:

    标签: android android-studio android-gradle-plugin build.gradle


    【解决方案1】:

    是的,不过,如果你在这里查看 https://github.com/nhartner/xrpl4j-android-demo/blob/main/app/build.gradle#L34

    他正在使用 mavenlocal() ,因此将它们替换为

    implementation 'org.xrpl:xrpl4j-client:2.1.0'
    implementation 'org.xrpl:xrpl4j-keypairs:2.1.0'
    

    并从存储库中删除 mavenlocal() 可能会解决问题。 除非他对他的本地版本进行任何修改。

    更多关于本地 Maven 的阅读 https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:case-for-maven-local

    【讨论】:

      猜你喜欢
      • 2020-06-07
      • 1970-01-01
      • 2014-05-03
      • 1970-01-01
      • 2020-09-10
      • 2019-08-23
      • 1970-01-01
      • 2017-06-03
      • 1970-01-01
      相关资源
      最近更新 更多