Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Now that you’ve got the starter files setup and ready to go on your computer, we can create your first Firebase Project in the Firebase Console and add Firebase to your Android app.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Now that you've got the project
file set up on your computer,
0:00
we're going to create your
first Firebase project.
0:02
In order to do that,
we'll navigate to firebase.google.com.
0:05
From there, we'll click Go to Console.
0:10
You can alternatively just directly
go to cosole.firebase.google.com, but
0:13
all that typing gets tedious sometimes.
0:17
From the Firebase Console,
0:20
we could view all of our Firebase
project as well as create new projects.
0:22
Let's create a new project now.
0:25
As you can see, I already have
the project created in my Console but
0:28
I'll walk through the process
again to help show you the steps.
0:31
Click the Create New Project button,
and give your project a name.
0:35
I called mine Real time Messaging, but you
can call your project whatever you like.
0:39
After you've named your project and
selected your country click,
0:43
create project.
0:46
You'll then be brought to your
new projects landing page.
0:50
We explore this page in more detail,
in our getting started with Firebase
0:53
workshop, for now, we're just going to
follow the instructions at the top of
0:56
the page for adding Firebase
to your Android application.
0:59
Go ahead and
click Add Firebase to your Android app.
1:03
A dialogue box should pop up and
ask you for your apps package name.
1:06
It will also ask you for
1:10
an optional app nickname, an optional
debug signing certificate hash value.
1:11
We could ignore those last two fields, and
simply provide our app's package name.
1:15
The package name for
1:20
the apps supplied in the project files
is com.teamtreehouse.realtime messaging.
1:20
If you have a different value
in your applicationsapp\bill.
1:26
File, enter it here.
1:29
Once you provide the package
name of the application,
1:32
the ADD APP button become enabled.
1:34
Notice underneath the ad
app button in italics,
1:37
there's text that says downloads
google-services.json for your app.
1:39
That is simply a json file with
information that the firebase
1:44
STK uses to link your android and
firebased projects.
1:47
Once you click the ad app button,
1:52
the Google services Json
file will be downloaded.
1:53
Click the button to download the file and
1:56
then move it to your Android
applications app directory.
1:58
It is important that you place
the google-services.json file in
2:01
the appropriate location or
Firebase won't work.
2:03
Once the google-services.json file has
been downloaded to the correct location
2:07
we need to modify our build.gradle files
to use the Goggle services plug in.
2:12
To do that, navigate to the projects
root level build.gradofile and
2:17
add the line classpath
'com.google.gms;google-services;3.0.0.'
2:22
in your dependencies block.
2:29
We'll also need to add the dependency for
firebase itself.
2:31
We'll navigate to our app/build.gradle
file and add that now.
2:35
After you've done that
apply the plugin for
2:48
google services at the bottom of
your app model to build.gradle file.
2:50
Finally, sync your project to ensure
that everything's set up properly.
2:56
I know that there are a quite
a few steps here at first, but
3:01
the instructions are also online at
the link provided in the teacher's notes.
3:03
I've also included to-do's in the code
where changes need to be made to hopefully
3:07
make these steps even more explicit.
3:10
One thing I will mention is
that an Android Studio 2.2 and
3:13
above, the process of creating a Firebase
project and adding it to your Android
3:15
application can be done automatically by
the Firebase plugin in Android Studio.
3:19
I'm not going to show that in this video,
but it's definitely worth checking out,
3:24
will save you some time in the future.
3:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up