Firebase Storage is giving StorageException while trying to upload images

后端 未结 14 1893
北海茫月
北海茫月 2021-01-13 03:10

I have been trying to upload images to the new firebase storage service . It is throwing StorageException

E/StorageException: StorageException has occ

相关标签:
14条回答
  • 2021-01-13 03:51

    I encountered the same issue today.

    • You need to have up to date google play services.

    • At a minimum, Please enable anonymous authentication in firebase console.

    • Steps to follow to authenticate anonymously. https://firebase.google.com/docs/auth/android/anonymous-auth#authenticate-with-firebase-anonymously

    • You can also set bare minimum / no authentication in Rules(JSON in storage tab of console) (but it is not recommended as it is insecure).

    0 讨论(0)
  • 2021-01-13 03:54

    Don't forget to add

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

    In your AndroidManifest.xml

    0 讨论(0)
  • 2021-01-13 03:54
    1. Start with checking if you have granted the Permission of Internet in Your Manifest.

    2. Check if You have Granted The Correct Authorization Permission To Write To Your Storage in The "Rules" tab of your Storage.

    3. Try Logging the reference to Your Firebase Storage as well as to the File You are trying to upload. Check if its the same as the Firebase Project You are Working On In The Browser.

    In my case the project configuration was wrong, which is pretty much the first thing we do in the project. But hey! Its better than missing out on a ";"

    0 讨论(0)
  • 2021-01-13 04:00

    I was also getting the same exception but got over with it by simply granting Storage Permission to app from:

    Settings > Apps > {My App} > Permissions > Enable Storage

    The above part can also be done through Java code, I learned it in a tutorial for Android Marshmallow. Also, make sure to declare permission for INTERNET and READ_EXTERNAL_STORAGE in Android Manifest file. However, if you are still getting the exception, try updating play services as well.

    0 讨论(0)
  • 2021-01-13 04:02

    I was having the same issue. It's not storage permission problem, i just changed the Firebase Storage Rules then solved.

    rules_version = '2';
    service firebase.storage {
      match /b/{bucket}/o {
        match /{allPaths=**} {
          allow read, write: if request.auth != null;
        }
      }
    }
    

    Above are default rules which works fine. Changing the condition may cause Exception. Please check your condition before use.

    0 讨论(0)
  • 2021-01-13 04:03

    I was facing the same issue. I removed existed google.services.json file, download once again from firebase console and add it to my project.Now it is working successfully.

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