0

I'm a beginner on Android. I updated all the dependencies of my Firebase project in the Android Studio gradle. But when compiling an apk, this error appears:

error: cannot find symbol method getDownloadUrl()

I've been trying to solve this problem for days, and I've decided to ask for help. I have already seen some tips on how to solve, but none worked for me. If anyone can give me a light, I thank you very much.

 //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<>();
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
brayonsc
  • 15
  • 4
  • Thanks for the tip – brayonsc May 15 '19 at 14:00
  • `getDownloadUrl` no longer exists on `UploadTaskSnapshot`, but is now available on `StorageReference`. See the documentation here: https://firebase.google.com/docs/storage/android/upload-files#get_a_download_url, and my answer here: https://stackoverflow.com/questions/51056397/how-to-use-getdownloadurl-in-recent-versions/51064689#51064689 – Frank van Puffelen May 15 '19 at 14:13

1 Answers1

0

by using FireConstants in method onSuccess you can find getDownloadUrl() method

FireConstants.getDownloadUrl().addOnSuccessListener
Ahmed El-Nakib
  • 179
  • 1
  • 6