我尝试在Android Studio中使用glide来处理来自R.drawable中存储的资源的GIF动画,但我得到“无法解析sysmbol '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);
4条答案
按热度按时间enyaitl31#
我通过从build.gradle中删除依赖项并同步我的项目来解决这个问题,然后再次向项目build.gradle添加glide依赖项并再次同步。
2w3rbyxf2#
我还通过删除依赖项,然后再次将glide依赖项添加到project builde.gradle并再次同步来解决这个问题
zysjyyx43#
我也遇到了同样的问题。最初,我添加了以下依赖项:
我只是将glide依赖项版本降级到4.12.0,然后再次同步,它对我很有效。
zd287kbt4#
应使用以下相关性
第一节第二节第一节第三节第一节