Android Studio -无法解析符号“滑动”

slwdgvem  于 2022-12-27  发布在  Android
关注(0)|答案(4)|浏览(166)

我尝试在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);
enyaitl3

enyaitl31#

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

2w3rbyxf

2w3rbyxf2#

我还通过删除依赖项,然后再次将glide依赖项添加到project builde.gradle并再次同步来解决这个问题

zysjyyx4

zysjyyx43#

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

dependencies {
    ...

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

    ...
}

我只是将glide依赖项版本降级到4.12.0,然后再次同步,它对我很有效。

dependencies {
    ...

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

    ...
}
zd287kbt

zd287kbt4#

应使用以下相关性

/**
     * 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
    }

第一节第二节第一节第三节第一节

相关问题