error: cannot find symbol method crossFade() in 4.7.1

两盒软妹~` 提交于 2019-12-11 06:24:53

问题


Before anyone duplicate it. I was using the below code before in v3.7.0 of glide. Now when I have updated it to 4.7.1 it is showing the error: cannot find symbol method crossFade().

I have searched in different places but could not get the code work.

Glide.with(this)
                    .load(uriProfileImage)
                    .crossFade()
                    .bitmapTransform(new CircleTransform(EditProfile.this))
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .into(changeImage);

回答1:


I haven't used Glide myself, but based on this v4 documentation it looks like you need to use a transition and a TransitionOptions to specify a cross-fade, so your code would look something like this:

import static com.bumptech.glide.load.resource.drawable.BitmapTransitionOptions.withCrossFade;

...

Glide.with(this)
    .load(uriProfileImage)
    .transition(withCrossFade())
    .bitmapTransform(new CircleTransform(EditProfile.this))
    .diskCacheStrategy(DiskCacheStrategy.ALL)
    .into(changeImage);

(I've assumed you want a BitmapTransitionOptions rather than DrawableTransitionOptions here, given the bitmapTransform call.)

You should probably also read the "common errors" section about cross-fades too.




回答2:


I had the same issue, use old version solve the problem. implementation 'com.github.bumptech.glide:glide:3.7.0' than implementation 'com.github.bumptech.glide:glide:4.9.0' which is the last version



来源:https://stackoverflow.com/questions/51463988/error-cannot-find-symbol-method-crossfade-in-4-7-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!