问题描述
一切都很好,直到我从3个月的休息时间回来工作,并将我的Firebase从9.8更新到10.0.1现在我所有的调用 TaskSnapshot
给我一个错误。
以下是可以正常工作的示例代码:
OnSuccessListener< UploadTask.TaskSnapshot> ()添加一个新的文件,并将其添加到文件名中,然后添加一个新的文件。 。getDownloadUrl()的toString());
numberOfCallbacks ++;
if(numberOfFiles == numberOfCallbacks){
currentUpload = false;
onClickSendAlert(sendingView);
}
}
};
现在我得到的错误是关于 Android Studio强调了红线,并说: 有人可以解释为什么会发生这种情况吗?我一直在研究整天两天,现在不能为我的生活弄明白(尴尬)。 这个代码是值得的用于将文件上传到Firebase存储,然后在完成时( 下面是一个截图,让您更好地了解我的情况: 相关,则应该是固定在2.4。 Everything was working great... until I came back to work from a 3 month break and updated my Firebase from 9.8 to 10.0.1 Now all of my calls to Here is the example code that worked fine before: The error that I now get is regarding Android Studio underlines that line in red and says: Can someone explain why this is happening? I have been researching all day for two days straight now and can't for the life of me figure this out (embarrassing). For what it's worth, this code is used to upload a file to Firebase Storage, then when it is complete ( Here is a screenshot to give you a better visual of my situation: The problem seems to be caused by an overzealous Lint check. Try something like this: This trick worked for me. If the problem's related to this bug report, then it should be fixed in 2.4. 这篇关于Android - Firebase - TaskSnapshot - 只能在私人范围内访问方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! taskSnapshot.getDownloadUrl() code $。
OnSuccess
),获取下载URL并将其存储在Firebase数据库中。在我更新到10.0.1之前,这很好用。我在另一个模块的下载任务中遇到了同样的错误。
TaskSnapshot
are giving me an error.OnSuccessListener<UploadTask.TaskSnapshot> successListener = new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
attachments.add(fileName + "*-*" + taskSnapshot.getDownloadUrl().toString());
numberOfCallbacks++;
if (numberOfFiles == numberOfCallbacks) {
currentUpload = false;
onClickSendAlert(sendingView);
}
}
};
taskSnapshot.getDownloadUrl()
.OnSuccess
), it gets the download URL and stores it in the Firebase Database. This worked great before I updated to 10.0.1. I get the same error on my download tasks in another module.@SuppressWarnings("VisibleForTests") Uri downloadUrl = taskSnapshot.getDownloadUrl();