更新后firebase的问题

时间:2019-09-03 14:57:27

标签: android firebase firebase-storage

嘿,我有一个问题,我在app.gradle中更改了Firebase版本,现在总是收到此错误代码“错误:找不到符号方法getDownloadUrl() “

我已经尝试了几种方法,但不幸的是我没有解决办法

private void saveUserPhoto() {
    if (resultUri != null) {
        StorageReference filepath = FirebaseStorage.getInstance().getReference().child("profileImages").child(userId);
        Bitmap bitmap = null;

        try {
            bitmap = MediaStore.Images.Media.getBitmap(getApplication().getContentResolver(), resultUri);
        } catch (IOException e) {
            e.printStackTrace();
        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, 20, baos);
        byte[] data = baos.toByteArray();
        UploadTask uploadTask = filepath.putBytes(data);
        uploadTask.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                finish();
            }
        });

        uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                Uri downloadUrl = taskSnapshot.getDownloadUrl();

                Map userInfo = new HashMap<>();
                userInfo.put("profileImageUrl", downloadUrl.toString());
                mPhotoDB.updateChildren(userInfo);

                return;
            }
        });
    }
}

错误:找不到符号方法getDownloadUrl()

0 个答案:

没有答案