How to integrate Firebase using the Glide ('using') method

I am trying to use Firebase integration with Glide, and for some reason, Glide.using() cannot resolve this method. I added:

 compile 'com.firebaseui:firebase-ui-storage:0.6.0' 

In build.gradle as well:

 compile 'com.github.bumptech.glide:glide:4.0.0-RC1' 

Here is the part I'm trying to use Glide:

  mStorageRef = FirebaseStorage.getInstance().getReference(); mStorageRef.child("images/Puffer-fish-are-pretty-damn-cute.jpg"); // Load the image using Glide Glide.with(this) .using(new FirebaseImageLoader()) // cannot resolve method using! .load(mStorageRef) .into(imageView); 

I hope you can help me with this, have not found any solutions on the Internet.

+9
java android firebase firebase-storage android-glide
source share
2 answers

To solve this problem, please change this line:

 compile 'com.github.bumptech.glide:glide:4.0.0-RC1' 

from

 compile 'com.github.bumptech.glide:glide:3.7.0' 
+8
source share

Glide v4 uses module loaders with an annotation processor library.

Create an AppGlideModule and register a FirebaseImageLoader . When loading images, use StorageReference .

Here it is in the details.

Add Libraries to Gradle

 implementation 'com.github.bumptech.glide:glide:4.7.1' annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1' implementation 'com.firebaseui:firebase-ui-storage:4.1.0' 

Expand the module and register

 @GlideModule public class MyAppGlideModule extends AppGlideModule { @Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { registry.append(StorageReference.class, InputStream.class, new FirebaseImageLoader.Factory()); } } 

Download images with ref

 Uri uri = Uri.parse(photoUrl); StorageReference ref = FirebaseStorage.getInstance().getReference().child(uri.getPath()); Glide.with(itemView.getContext()) .load(ref) .into(thumb); 
+2
source share

All Articles