Get started with Cloud Storage on Android Stay organized with collections Save and categorize content based on your preferences.
Cloud Storage for Firebase lets you upload and share user generated content, suchas images and video, which allows you to build rich media content into yourapps. Your data is stored in aGoogle Cloud Storage bucket — anexabyte scale object storage solution with high availability and globalredundancy.Cloud Storage for Firebase lets you securely upload these filesdirectly from mobile devices and web browsers, handling spotty networks withease.
Before you begin
If you haven't already, make sure you've completed thegetting started guide for Android apps.This includes:
Creating a Firebase project.
Registering your Android app with the project,and connecting your app to Firebase by adding the Firebase dependencies,the Google services plugin, andyour Firebase config file (
google-services.json) to your app.
Make sure your Firebase project is on thepay-as-you-go Blaze pricing plan, whichis a requirement that started in October 2024 (see ourFAQs).If you're new to Firebase and Google Cloud, check if you're eligible for a$300 credit.
Create a defaultCloud Storage bucket
From the navigation pane of theFirebase console, selectStorage.
If your project is not yet on the pay-as-you-go Blaze pricing plan, then you'll beprompted to upgrade your project.
ClickGet started.
Select alocation for your default bucket.
Buckets in
,US-CENTRAL1 , andUS-EAST1 can take advantage of the"Always Free" tier forGoogle Cloud Storage.Buckets in all other locations followGoogle Cloud Storage pricing and usage.US-WEST1If you'd like, you can latercreate multiple buckets, each with itsown location.
Configure theFirebase Security Rules for your default bucket. During development,considersetting up your rules for public access.
ClickDone.
You can now view the bucket in theCloud StorageFiles tab of theFirebase console. Your default bucket name format isPROJECT_ID.firebasestorage.app
PROJECT_ID.firebasestorage.appPROJECT_ID.appspot.comSet up public access
Cloud Storage for Firebase provides a declarative rules language that lets youdefine how your data should be structured, how it should be indexed, and whenyour data can be read from and written to. By default, read and write access toCloud Storage is restricted so only authenticated users can read or writedata. To get started without setting upAuthentication, you canconfigure your rules for public access.
This does makeCloud Storage open to anyone, even people not using yourapp, so be sure to restrict yourCloud Storage again when you set upauthentication.
Add theCloud Storage SDK to your app
In yourmodule (app-level) Gradle file(usually<project>/<app-module>/build.gradle.kts or<project>/<app-module>/build.gradle),add the dependency for theCloud Storage library for Android. We recommend using theFirebase Android BoMto control library versioning.dependencies{// Import theBoM for the Firebase platformimplementation(platform("com.google.firebase:firebase-bom:34.9.0"))// Add the dependency for theCloud Storage library// When using theBoM, you don't specify versions in Firebase library dependenciesimplementation("com.google.firebase:firebase-storage")}
By using theFirebase Android BoM, your app will always use compatible versions of Firebase Android libraries.
(Alternative) Add Firebase library dependencies without using theBoM
If you choose not to use theFirebase BoM, you must specify each Firebase library version in its dependency line.
Note that if you usemultiple Firebase libraries in your app, we strongly recommend using theBoM to manage library versions, which ensures that all versions are compatible.
dependencies{// Add the dependency for theCloud Storage library// When NOT using theBoM, you must specify versions in Firebase library dependenciesimplementation("com.google.firebase:firebase-storage:22.0.1")}
Set upCloud Storage in your app
Make sure the Firebase config file (
google-services.json) in your app'scodebase is updated with the name of your defaultCloud Storage bucket.Use this downloaded config file toreplace the existing
google-services.jsonfile in your app's module (app-level) directory.Make sure that you only have this most recent downloaded config file inyour app and that its filename isn't appended with additionalcharacters, like
(2).
FirebaseStorage(see next step). You can find the bucket name in theCloud StorageFiles tab of theFirebase console.Access yourCloud Storage bucket by creating an instance of
FirebaseStorage:Kotlin
storage=Firebase.storage
// Alternatively, explicitly specify the bucket name URL.// val storage = Firebase.storage("gs://BUCKET_NAME")
Java
FirebaseStoragestorage=FirebaseStorage.getInstance();
// Alternatively, explicitly specify the bucket name URL.// FirebaseStorage storage = FirebaseStorage.getInstance("gs://BUCKET_NAME");
You're ready to start usingCloud Storage!
Next step? Learn how tocreate aCloud Storage reference.
Advanced setup
There are a few use cases that require additional setup:
- UsingCloud Storage buckets inmultiple geographic regions
- UsingCloud Storage buckets indifferent storage classes
- UsingCloud Storage buckets with multiple authenticated users in the same app
The first use case is perfect if you have users across the world, and want tostore their data near them. For example, you can create buckets in the US,Europe, and Asia to store data for users in those regions to reduce latency.
The second use case is helpful if you have data with different access patterns.For example: you can set up a multi-regional or regional bucket that storespictures or other frequently accessed content, and a nearline or coldline bucketthat stores user backups or other infrequently accessed content.
In either of these use cases, you'll want touse multipleCloud Storage buckets.
The third use case is useful if you're building an app, like Google Drive, whichlets users have multiple logged in accounts (for instance, a personal accountand a work account). You canuse a custom Firebase Appinstance to authenticate each additional account.
Use multipleCloud Storage buckets
If you want to use aCloud Storage bucket other than the default bucket describedearlier in this guide, or use multipleCloud Storage buckets in a single app, youcan create an instance ofFirebaseStorage that references your custom bucket:
Kotlin
// Get a non-default Storage bucketvalstorage=Firebase.storage("gs://my-custom-bucket")
Java
// Get a non-default Storage bucketFirebaseStoragestorage=FirebaseStorage.getInstance("gs://my-custom-bucket");
Working with imported buckets
When importing an existingCloud Storage bucket into Firebase, you'llhave to grant Firebase the ability to access these files using thegsutil tool, included in theGoogle Cloud SDK:
gsutil -m acl ch -r -u service-PROJECT_NUMBER@gcp-sa-firebasestorage.iam.gserviceaccount.com gs://BUCKET_NAME
You can find your project number as described in theintroduction to Firebase projects.
This does not affect newly created buckets, as those have the default accesscontrol set to allow Firebase. This is a temporary measure, and will beperformed automatically in the future.
Use a custom Firebase App
If you're building a more complicated app using a customFirebaseApp, you cancreate an instance ofFirebaseStorage initialized with that app:
Kotlin
// Get the default bucket from a custom FirebaseAppvalstorage=Firebase.storage(customApp!!)// Get a non-default bucket from a custom FirebaseAppvalcustomStorage=Firebase.storage(customApp,"gs://my-custom-bucket")
Java
// Get the default bucket from a custom FirebaseAppFirebaseStoragestorage=FirebaseStorage.getInstance(customApp);// Get a non-default bucket from a custom FirebaseAppFirebaseStoragecustomStorage=FirebaseStorage.getInstance(customApp,"gs://my-custom-bucket");
Next steps
Prepare to launch your app:
EnableApp Check to help ensure that onlyyour apps can access your storage buckets.
Set upbudgetalertsfor your project in theGoogle Cloud console.
Monitor theUsage and billingdashboard in theFirebase console to get an overall picture of your project'susage across multiple Firebase services.You can also visit theCloud StorageUsagedashboard for moredetailed usage information.
Review theFirebase launch checklist.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-18 UTC.