How to upload images to Firebase Storage

Hello Guys! In this tutorial, we’ll learn how to use Firebase Storage. We are going to build a very simple android app which contains and an ImageView and a Button. User will select an image file from his gallery and the selected image will get uploaded to the Firebase Storage on click of a Button. So, Let’s get started.

1.) Create a new project in Firebase console or choose an existing one. Click on Storage from the sidebar and copy the Firebase storage URL (eg: gs:// Go to RULES tab and set the request.auth !=null to request.auth==null as we are not going to authenticate users. PUBLISH the changes after modifying.


2.) Create a new Android project “FirebaseStorageDemo”. Add the Firebase Storage to your app.

App level Gradle File

Add the below lines in your app level gradle file.

compile 'com.firebase:firebase-client-android:2.3.1'
compile ''
compile ''
apply plugin: ''
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'


Project level gradle file

Add the  below classpath in the dependencies section.

classpath ''

3.) Add your android app to the Firebase project by clicking ADD APP button in the Overview page of Firebase console. Enter the package name and SHA1 debug key. Download the google-services.json file and place it in your app/ directory of your Android project.

4.) Now, open the layout(activity_main) for your MainActivity and create an ImageView and a Button.

5.) Add the below code in your MainActivity.

6.) Run the app and select an Image from Gallery. On clicking the upload image button, the selected image will be uploaded to your Firebase Storage.







That’s it for this tutorial. Thank you 🙂


Issues? Please comment below.

admin Author



    (December 25, 2016 - 9:36 AM)

    I did exactly as above but getting this error

    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzab;
    at Source)


      (December 29, 2016 - 12:06 AM)

      Just update your google play services to the latest version and try again.

Leave a Reply

Your email address will not be published. Required fields are marked *