I\'m trying to use Firebase integration with Glide and for some reason,
Glide.using()
cannot resolve this method.
I did add:
compile \'com.firebase
Glide v4 is using module loaders with the annotation processor library.
Create AppGlideModule
and then register FirebaseImageLoader
. When loading images use StorageReference
.
Here it is in details.
Add libraries in 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'
Extend 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());
}
}
Load images with ref
Uri uri = Uri.parse(photoUrl);
StorageReference ref = FirebaseStorage.getInstance().getReference().child(uri.getPath());
Glide.with(itemView.getContext())
.load(ref)
.into(thumb);