I am new to this whole Firebase Storage concept.
I did a little research and found this Glider. For adding the image to imageView. Now it is giving me this error.
How do i fix it?
Is there another way to do this?
24 09:39:00.286 14919-14919/azcrew.eatapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: azcrew.eatapp, PID: 14919
java.lang.IllegalArgumentException: Unknown type class com.google.firebase.storage.StorageReference. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class
at com.bumptech.glide.RequestManager.loadGeneric(RequestManager.java:629)
at com.bumptech.glide.RequestManager.load(RequestManager.java:598)
at azcrew.eatapp.halfdone.Cari$2.onSuccess(Cari.java:76)
at azcrew.eatapp.halfdone.Cari$2.onSuccess(Cari.java:73)
at com.google.android.gms.tasks.zzj.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Here is the code
StorageReference mStorageRef = FirebaseStorage.getInstance().getReference();
final StorageReference imgRef = mStorageRef.child("images/img.jpg");
final long ONE_MEGABYTE = 1024*1024;
imgRef.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() {
@Override
public void onSuccess(byte[] bytes) {
Glide.with(Cari.this).load(imgRef).diskCacheStrategy(DiskCacheStrategy.ALL).into(kuryerImg);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
}
});