【问题标题】:Latest version of Glide giving dependency error最新版本的 Glide 出现依赖错误
【发布时间】:2018-05-20 09:25:56
【问题描述】:

我已将 Glide 的版本从 4.0.0-RC0 升级到 4.4.0。但它给了我一个错误说

Error:Module 'com.github.bumptech.glide:glide:4.4.0' depends on one or more Android Libraries but is a jar

这不是说哪个罐子或任何其他信息。 有人知道如何解决这个问题吗?我还在 build.gradle 中附加了 Glide 的条目

compile 'com.github.bumptech.glide:glide:4.4.0'
compile 'com.github.bumptech.glide:okhttp3-integration:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
compile 'com.github.bumptech.glide:annotations:4.4.0'

编辑:我正在使用支持库版本 27.0.1

【问题讨论】:

  • 你已经把 annotationyProcessor 行放了 2 次​​span>
  • 问这个问题时这是一个错字,它不在我的代码中。现在编辑问题。
  • 问题在于 Glide ,github.com/bumptech/glide/issues/2318 ,尝试 4.3.1 版本我没有任何问题
  • @Redman 我能够修复依赖错误,但现在应用程序崩溃并出现以下错误:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/gifdecoder/GifDecoder$BitmapProvider;我需要使用最新版本的 Glide 来支持我的应用程序中的一些复杂动画,这就是我试图让这个东西工作的原因。
  • 你试过用compile('com.github.bumptech.glide:glide:4.4.0@aar') { transitive = true; }导入Glide

标签: android gradle android-glide


【解决方案1】:

您可以在构建中像这样使用它。简单地说:

dependencies {
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
}

【讨论】:

  • 这不是答案。和我一样,最新的 gradle 版本中引入了“实现”。我的 gradle 版本没有任何问题。
【解决方案2】:

这可能是滑翔问题,所以我宁愿不更新滑翔到com.github.bumptech.glide:glide:4.4.0 直到现在。您可以使用旧版本,例如 com.github.bumptech.glide:glide:4.3.1com.github.bumptech.glide:glide:4.3.0com.github.bumptech.glide:glide:4.2.0

您可以在

上阅读有关这些问题的更多信息

issue 2318

issue 2319

【讨论】:

    【解决方案3】:

    我遇到了同样的问题,但使用它解决了它:

    compile('com.github.bumptech.glide:glide:4.4.0@aar') {
        transitive = true;
    }
    

    要拉入包含@GlideModule 的注解模块,你必须使用transitive = true

    【讨论】:

    • 适用于 4.4.0 但不适用于 4.6.0。我将恢复到 4.4。谢谢。
    【解决方案4】:

    只需执行以下步骤即可避免此错误:

    1 - 将您的 sdk 版本更新到 27

    2 - 在 build.gradle 的依赖项中:

    implementation('com.github.bumptech.glide:glide:4.6.1') {
        exclude group: "com.android.support"
    }
    

    你很高兴,因为这个解决了我的问题。

    【讨论】:

      【解决方案5】:
      implementation 'com.github.bumptech.glide:glide:4.0.0-RC0'
      

      一旦检查此依赖项以获取最新的 android studio 3.0.2,此依赖项将构建正确的 gradle。

      【讨论】:

        【解决方案6】:

        只需在 app.gradle 中使用它即可:

        compile 'com.github.bumptech.glide:glide:3.7.0'
        

        【讨论】:

          最近更新 更多