StorageException: An unknown error occurred, please check the HTTP result code and inner exception for server response

前端 未结 13 2065
执念已碎
执念已碎 2021-02-09 20:19

I use Firebase Storage to upfile. But it does not work THIS IS MY CODE.

FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference sto         


        
相关标签:
13条回答
  • 2021-02-09 20:47

    There can be various reasons for this error, since it is not pointing out the reason. But things can be done. First update the storage library of firebase to latest version in gradle file. Second check permissions in android settings

    0 讨论(0)
  • 2021-02-09 20:50

    Make sure you've connected to firebase. Open the firebase assistant, go to storage, click on upload and download a file from storage and check. Connecting is easy. Just click on the connect button.

    0 讨论(0)
  • 2021-02-09 20:51

    update your firebase-storage dependency

    implementation 'com.google.firebase:firebase-storage:17.0.0'
    
    0 讨论(0)
  • 2021-02-09 20:52

    For me this error was triggered when uploading a 0.0 KB image file; that is because I was testing image compression algorithm that has a bug resulting in 0.0 KB image in some cases.

    So, make sure that the image/file you upload is greater than 0 KB.

    0 讨论(0)
  • 2021-02-09 20:56

    Add correct dependencies:

    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-storage:17.0.0'
    implementation 'com.google.firebase:firebase-database:17.0.0'
    
    0 讨论(0)
  • 2021-02-09 20:59

    So the I had the same problem and I easily fixed it!, so this is not a problem with firebase, but the problem is that your file can not be accessed from your local disk!

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    

    for api 21+ you will need to request permission, for security reasons, check this article for more information: How to request storage permission

    0 讨论(0)
提交回复
热议问题