Darryl Fernandes
Darryl Fernandes

Reputation: 161

Unable to load Profile Picture using Glide Library from Firebase

I am trying to load the profile picture which is uploaded in firebase. I am using the Glide Library to load images into a circular image view which uses this library.

I have tried both the methods i.e. using Firebase UI and by getting the uri by using getDownlodUrl() method.

I am able to successfully get the download URL but glide is giving me an error which I am unable to understand.

I tried googling the error, but to no avail. Please help to see where I am going wrong

Here is the Log:

2019-07-06 19:32:37.149 21919-23194/com.avalonglobalresearch.creatives      D/skia: --- Failed to create image decoder with message 'unimplemented'
2019-07-06 19:32:37.156 21919-23194/com.avalonglobalresearch.creatives    I/chatty: uid=10160(com.avalonglobalresearch.creatives) glide-source-th identical 6 lines
2019-07-06 19:32:37.157 21919-23194/com.avalonglobalresearch.creatives D/skia: --- Failed to create image decoder with message 'unimplemented'
2019-07-06 19:32:37.186 21919-21919/com.avalonglobalresearch.creatives W/Glide: Load failed for gs://creatives-4ebde.appspot.com/ with size [406x378]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 4 causes:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
  Cause (1 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, DATA_DISK_CACHE, com.firebase.ui.storage.images.FirebaseImageLoader$FirebaseStorageKey@bf00ba2
    Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}
    Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Bitmap->Drawable}
    Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->BitmapDrawable->Drawable}
  Cause (2 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, DATA_DISK_CACHE, com.firebase.ui.storage.images.FirebaseImageLoader$FirebaseStorageKey@bf00ba2
    Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
    Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
    Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
  Cause (3 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, DATA_DISK_CACHE, com.firebase.ui.storage.images.FirebaseImageLoader$FirebaseStorageKey@bf00ba2
There were 2 causes:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
    Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->Drawable}
There was 1 cause:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000
    Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->BitmapDrawable->Drawable}
There was 1 cause:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000
  Cause (4 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, REMOTE, com.firebase.ui.storage.images.FirebaseImageLoader$FirebaseStorageKey@bf00ba2
    Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}
    Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Bitmap->Drawable}
    Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->BitmapDrawable->Drawable}
  Cause (5 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, REMOTE, com.firebase.ui.storage.images.FirebaseImageLoader$FirebaseStorageKey@bf00ba2
 2019-07-06 19:32:37.187 21919-21919/com.avalonglobalresearch.creatives W/Glide:    Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
    Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
    Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
  Cause (6 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, REMOTE, com.firebase.ui.storage.images.FirebaseImageLoader$FirebaseStorageKey@bf00ba2
There were 2 causes:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
    Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->Drawable}
There was 1 cause:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000
    Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->BitmapDrawable->Drawable}
There was 1 cause:
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
 call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000
2019-07-06 19:32:37.190 21919-21919/com.avalonglobalresearch.creatives I/Glide: Root cause (1 of 4)
java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000

Here is my code:

databaseReference = FirebaseDatabase.getInstance().getReference();
storageReference = FirebaseStorage.getInstance().getReference();

databaseReference.child("users").child(user.getUid()).addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot){
            name2 = (String) dataSnapshot.child("name").getValue();
            bio2 = (String) dataSnapshot.child("bio").getValue();

            //imageUri = (URL) dataSnapshot.child("profilePic").getValue();
            String gender = (String) dataSnapshot.child("gender").getValue();
            String email = (String) dataSnapshot.child("email").getValue();

            Log.d("TAG", "Name: " +name2);
            Log.d("TAG", "Email: " +email);
            Log.d("TAG", "Gender: " +gender);
            Log.d("TAG" , "Profile Pic URI = "+imageUri);
            nameTextView.setText(name2);
            bioTextView.setText(bio2);
            String uid = user.getUid();
            Log.d("TAG" , "UID = " +uid);
            storageReference.child("ProfilePictures").child(uid+".jpg");
            GlideApp.with(getActivity()).load(storageReference).into(test);

            /*storageReference.child("ProfilePictures").child(uid+".jpg").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                @Override
                public void onSuccess(Uri uri) {
                    // Got the download URL for 'users/me/profile.png'
                    Log.d("TAG" , "URI = "+uri);

                    GlideApp.with(getActivity()).load(storageReference).into(profilepic);
                    //GlideApp.with(getActivity()).load(storageReference).into(test);
                    //profilepic.setImageURI(uri);
                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception exception) {
                    // Handle any errors
                    Toast.makeText(getActivity(), "Error getting Profile Picture", Toast.LENGTH_LONG).show();
                }
            });*/
        }

I have implemented the Firebase UI dependency.

PS: the commented code is the 2nd method that I mentioned above.

Upvotes: 1

Views: 2181

Answers (1)

Deˣ
Deˣ

Reputation: 4371

Try

 String imageUrl = (String) dataSnapshot.child("profilePic").getValue();

 GlideApp.with(getActivity()).load(imageUrl).into(test);

Upvotes: 2

Related Questions