Android Studio - 无法解析符号 'Glide'

5
我正在尝试在Android Studio中使用Glide来处理存储在R.drawable中的Gif动画,但我遇到了“无法解决符号'Glide'”的问题。
我已经在build.gradle中添加了Glide依赖项。
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
}

我正在使用以下代码将图像视图设置为gif。

ImageView img=(ImageView)findViewById(R.id.catImg);
int resourceId = R.drawable.gangrycat;
Glide.with(this.context)
     .load(resourceId)
     .into(img);

我已经修复了它,说实话,我感觉有点傻。 - Elton Peake
4个回答

4

我通过从build.gradle文件中删除依赖项并同步我的项目,然后再次将Glide依赖项添加到项目的build.gradle文件中并再次同步来解决了这个问题。


同步Android项目的命令:文件 -> 与Gradle文件同步项目 - Петр Воротинцев

0

我也通过删除依赖项,然后再将Glide依赖项添加到项目build.gradle中并同步来解决了这个问题。


0

应使用以下依赖项

    /**
     * Glide :- https://github.com/bumptech/glide
     */
    implementation 'com.github.bumptech.glide:annotations:4.14.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
    implementation ("com.github.bumptech.glide:glide:4.14.2@aar") {
        transitive = true
    }

enter image description here

enter image description here

enter image description here enter image description here


0

我也遇到了同样的问题。最初,我添加了以下依赖项:

dependencies {
    ...

    implementation 'com.github.bumptech.glide:glide:4.14.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.14.0'

    ...
}

我刚刚将滑动依赖项的版本降级为4.12.0并重新同步,现在可以正常工作。

dependencies {
    ...

    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

    ...
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接