Error whenever I try to upload any file:
Code for uploading image to storage:
private void uploadFileToStorage(String uid,String[] data){
StorageReference ref = FirebaseStorage.getInstance().getReference().child("idiot");
ref.putFile(noticeUri)
.addOnSuccessListener(taskSnapshot ->
ref.getDownloadUrl().addOnSuccessListener(uri -> {
showUploadMessage(100,"Saving to database...");
dismissMainDialog();
//saveToDatabase(uid,data,String.valueOf(uri));
}).addOnFailureListener(e -> {
dismissMainDialog();
showSnackBar("Failed to save in database");
})
).addOnFailureListener(e -> {
dismissMainDialog();
showSnackBar(e.getMessage());
}).addOnProgressListener(snapshot -> {
int percent = (int)(snapshot.getBytesTransferred()/snapshot.getTotalByteCount())*100;
showUploadMessage(percent,null);
});
}
implementation 'com.google.firebase:firebase-storage:20.0.0' implementation 'com.google.firebase:firebase-database:20.0.2' implementation 'com.google.firebase:firebase-auth:21.0.1' implementation platform('com.google.firebase:firebase-bom:29.0.0') implementation 'com.google.firebase:firebase-analytics'
I don't know where is the problem. I have also updated google-service.json
after creating bucket.
Not working even after creating new project & adding dependencies
1. Go to google cloud console Cloud Console
2.
3.Add the line firebase-storage@system.gserviceaccount.com
& save as storage admin
4. Wait for few minutes, then problem should be solved
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.