我是Android上的初学者。我在Android Studio gradle中更新了Firebase项目的所有依赖项。但是在编译apk时,会出现此错误:
error: cannot find symbol method getDownloadUrl()
几天来我一直在努力解决这个问题,因此我决定寻求帮助。我已经看到了一些解决方法的提示,但没有一个对我有用。如果有人可以给我带来一点光,我非常感谢您。
//this will upload the user photo that he picked and generate a Small circle image and decode as base64
public static void updateMyPhoto(final String imagePath, final OnComplete onComplete) {
//generate new name for the file when uploading to firebase storage
String fileName = UUID.randomUUID().toString() + Util.getFileExtensionFromPath(imagePath);
//upload image
FireConstants.imageProfileRef.child(fileName).putFile(Uri.fromFile(new File(imagePath)))
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
//get download url of the image
String downloadUrl = String.valueOf(taskSnapshot.getDownloadUrl());
Map<String, Object> updateMap = new HashMap<>();
答案 0 :(得分:0)
通过在方法FireConstants
中使用onSuccess
,您可以找到getDownloadUrl()
方法
FireConstants.getDownloadUrl().addOnSuccessListener