android - Android Studio 中的 Gradle 无法解析 JCenter 中的库

标签 android android-studio gradle android-gradle-plugin jcenter

我已向 Bintray 发布了一个库,并且已通知我它已正确链接到 JCenter。 Bintray中的库可以看到here可以肯定的是,它在 JCenter 中正确可见,如您所见 here .

我试图通过将其添加为 Gradle 依赖项来测试它,如下所示:

dependencies {
    compile 'com.truizlop.sectionedrecyclerview:library:1.0.0'
}

根据 maven-metadata.xml 文件,这应该是正确的:

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>com.truizlop.sectionedrecyclerview</groupId>
  <artifactId>library</artifactId>
  <version>1.0.0</version>
  <versioning>
    <latest>1.0.0</latest>
    <release>1.0.0</release>
    <versions>
      <version>1.0.0</version>
    </versions>
    <lastUpdated>20150717035732</lastUpdated>
  </versioning>
</metadata>

但是,当我同步 build.gradle 时,它会抛出以下错误:

无法解析:com.truizlop.sectionedrecyclerview:library:1.0.0

我已经检查过我是否能够同步 JCenter 中的任何其他依赖项,但我无法使用我自己的库来执行此操作。该库尚未发送到 Maven Central,但我认为这应该不是问题,因为 JCenter 是 Android Studio 的默认存储库。我错过了什么?

最佳答案

当我运行 gradle assembleDebug 从命令行,对于使用新项目向导创建的项目并添加依赖项,我得到:

inconsistent module metadata found. Descriptor:
com.truizlop.sectionedrecyclerview:sectionedRecyclerView:1.0.0 Errors: bad module name:
expected='library' found='sectionedRecyclerView'

您的POM<artifactId>sectionedRecyclerView</artifactId> ,这与 Artifact 的上传位置或您的 maven-metadata.xml 不匹配文件。

关于android - Android Studio 中的 Gradle 无法解析 JCenter 中的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31475270/

相关文章:

android-studio - 将下载的 .apk 导入 Android Studio?

android - 错误:使用Jar合并转换类以进行调试

groovy - 在 Gradle 中聚合任务

android - Android 没有 qsort_r(或者如何禁用强制 Thumb 在 Android ARM 代码中使用 CLZ)

android - 接收方未注册异常错误?

java - 类必须声明为抽象的或实现抽象方法?

android - 来自 jetified-aws-android-sdk 和 jetified-aws-java-sdk 的重复类

gradle - gradlew.bat(和gradlew)包装上的SSLHandShakeException,但未安装的gradle上

java - 如何将数据从android发送到服务器上的java应用程序

android - android studio SDK工具中 "ConstraintLayout for android"和 "Solver for ConstraintLayout"的区别