Error: cannot find symbol method getDownloadUrl() of type com.google.firebase.storage.UploadTask.TaskSnapshot

后端 未结 7 862
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 07:28

Before gradle update everything worked fine, but later on this error popped up. I have referred to the official documents and it provides the same code. Not accepting the ge

7条回答
  •  自闭症患者
    2020-11-29 08:18

    If you have a 'image_uri' and put it to the firebase storage this code will help you.

    private StorageReference storageReference= FirebaseStorage.getInstance().getReference();
    
     final StorageReference ref = storageReference.child("picture.jpg");
        ref.putFile(image_uri).addOnSuccessListener(new OnSuccessListener() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                ref.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
                    @Override
                    public void onSuccess(Uri uri) {
                        final Uri downloadUrl = uri;
    
    
                    }
                });
    

提交回复
热议问题