12

I'm having an issue with this project whenever I try to compile it displays the error

Error: cannot find symbol class GlideDrawable

please take a look at app: module

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
    exclude group: 'com.android.support',
    module: 'support-annotations'
  })
  compile 'com.android.support:appcompat-v7:27.0.2'
  compile 'com.android.support:cardview-v7:27.0.2'
  compile 'com.android.support:appcompat-v7:27.0.2'
  compile 'com.android.support:design:27.0.2'
  compile project(':SubProjects:lib_sound_crop')
  compile project(':SubProjects:libraryColorPickrBest')
  compile project(':SubProjects:library_gellaryfinal')
  compile 'com.android.support:multidex:1.0.2'
  implementation 'com.github.bumptech.glide:glide:4.6.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.6.0'
  compile 'jp.wasabeef:glide-transformations:2.0.1'
  compile 'com.google.firebase:firebase-messaging:11.8.0'
  compile 'com.google.firebase:firebase-ads:11.8.0'
  compile 'com.google.firebase:firebase-core:11.8.0'
  testCompile 'junit:junit:4.12'

and the project build

buildscript {
  repositories {
    mavenCentral()
    google()
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.1'
  }

thanks in advance

Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
  • There's no GlideDrawable any more, just change the types to Drawable. Check this https://github.com/bumptech/glide/issues/2104 – John Joe Feb 02 '18 at 03:26
  • I think now the Drawable is no more there in 4.11.0 version error: cannot find symbol import com.bumptech.glide.load.resource.drawable.Drawable; – sejn Sep 14 '20 at 10:09

2 Answers2

27

GlideDrawable is depreciated in 4.x version so if you are moving from 3.x to 4.x simple use Drawable.

For example if you are using listener somewhere in code then move to simple this method..

 .listener(new RequestListener<Drawable>() {
                @Override
                public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                    progressBar.setVisibility(View.GONE);
                    return false;
                }

                @Override
                public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                    progressBar.setVisibility(View.GONE);
                    return false;
                }
            })
kj007
  • 6,073
  • 4
  • 29
  • 47
1
   String imagePosterUrl=AppStrings.BASE_POSTER_PATH+movie.getPosterPath();
        ImageView ivPoset=holder.ivMoviePoster;

        Glide.with(activity).load(imagePosterUrl).addListener(new RequestListener<Drawable>() {
            @Override
            public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                return false;
            }

            @Override
            public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {

                //if you want to convert the drawable to ImageView
                Bitmap bitmapImage  = ((BitmapDrawable) resource).getBitmap();



                return false;
            }
        }).into(ivPoset);

This code for Glide version 4.8.0. You can update the version 4.8.0 and also update this code for getting drawable or Bitmap. Because of Simple Target and ViewTarget Class in glide deprecated.