Using Firebase Storage image with Glide

前端 未结 6 2064
醉梦人生
醉梦人生 2020-12-03 18:08

There are tons of duplicated answers I had tried almost all of them but I am still not able to use Firebase storage image with Glide.

First of all I am using docs

6条回答
  •  悲哀的现实
    2020-12-03 18:47

    I Know im bit late but it might help some of you. Use both of these in app build.gradle.

    implementation 'com.github.bumptech.glide:glide:4.10.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' //For Kotlin You should use kapt instead of annotationProcessor though.
    

    Then add This Class:

    @GlideModule
    public class MyAppGlideModule extends AppGlideModule {
    
        @Override
        public void registerComponents(Context context, Glide glide, Registry registry) {
            // Register FirebaseImageLoader to handle StorageReference
            registry.append(StorageReference.class, InputStream.class,
                    new FirebaseImageLoader.Factory());
        }
    }
    
     GlideApp.with(getActivity()).load(storageReference).into(profileImg);
    

    At last you need to go to File-> Invalidate Cache and Restart Done:)

提交回复
热议问题