4

I am getting cannot resolve symbol method crossFade() error in Glide when trying to display an image from a Gmail account.

private void handleSignInResult(GoogleSignInResult result) {
    Log.d(TAG, "handleSignInResult:" + result.isSuccess());
    if (result.isSuccess()) {
        // Signed in successfully, show authenticated UI.
        GoogleSignInAccount acct = result.getSignInAccount();

        Log.e(TAG, "display name: " + acct.getDisplayName());

        String personName = acct.getDisplayName();
        if(acct.getPhotoUrl() != null){

            personPhotoUrl = acct.getPhotoUrl().toString();
        }
        String email = acct.getEmail();

        Log.e(TAG, "Name: " + personName + ", email: " + email + ", Image: " + personPhotoUrl);
        txtName.setText(personName);
        txtEmail.setText(email);
        Glide.with(getApplicationContext()).load(personPhotoUrl).thumbnail(0.5f).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).into(imgProfilePic);


        updateUI(true);
    }
    else {
        // Signed out, show unauthenticated UI.
        updateUI(false);
    }
}

Note that crossFade() appears in red in my Android Studio as in the following image:

screenshot I tried the following solutions from Stack Overflow but none of them worked for me.

How can I overcome this error?

Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51
P Trivedi
  • 101
  • 1
  • 6

1 Answers1

0

This is kinda old but if other person stuck Glide.with(getApplicationContext()).load(personPhotoUrl).thumbnail(0.5f).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).into(imgProfilePic);

change to

Glide.with(getApplicationContext()).load(personPhotoUrl).thumbnail(0.5f).transition(withCrossFade()).diskCacheStrategy(DiskCacheStrategy.ALL).into(imgProfilePic);