嘿,我有一个问题,我在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()