user6650650
user6650650

Reputation:

Firebase setup confusion

I am following a YouTube tutorial on the topic Firebase. He extended the application class and called Firebase.setAndroidContext(Context) in onCreate. When I tried to do the same , I couldn't find the class Firebase or the static method setAndroidContext(). What am I doing wrong? I followed official guide to setup Firebase in my project.

I got this line is at the bottom of my app level gradle file

apply plugin: 'com.google.gms.google-services'

and this in project level gradle file

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

I also copied the needed json file to my project

Upvotes: 0

Views: 94

Answers (2)

Rissmon Suresh
Rissmon Suresh

Reputation: 14053

add compile 'com.google.firebase:firebase-core:9.6.1' in build.gradle(app)

Works fine if you follow instructions in https://firebase.google.com/docs/android/setup

No need for 'Firebase.setAndroidContext(Context)' in new sdk. 

just follow https://firebase.google.com/docs/cloud-messaging/android/client

Upvotes: 1

Joel Raju
Joel Raju

Reputation: 1360

In the new SDK, it's no longer necessary to call Firebase.setAndroidContext() so you can remove it from your code.

see the docs here : https://firebase.google.com/support/guides/firebase-android#setting_the_android_context_and_enabling_offline_persistence_numbered

Upvotes: 1

Related Questions