Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Cannot resolve symbol 'firebase'

I'm currently upgrading an app to the new Firebase version. I followed the guide, included classpath 'com.google.gms:google-services:3.0.0' in the dependencies of my project build.gradle as well as compile 'com.google.firebase:firebase-core:9.0.1' among others in the dependencies of my module build.gradle and also apply plugin: 'com.google.gms.google-services' at the end of that file.

I get a "cannot resolve symbol 'firebase'" in my imports i.e. import com.google.firebase.database.DatabaseReference;. Those are not errors that appear when building, so this seems to be working, but they are visible in the code editor of Android Studio.

The imports worked just fine a couple of days ago (except for FirebaseAuth, which was under maintenance). I did not change anything about the code since then (except trying to upgrade to 9.0.2, which lead to the same result). The only thing I did was update some components of the Android SDK, but I can't remember which. The Android SDK as well as Google Repository and Google Play Services are of the newest version. Rebuilding, cleaning and invalidate caches / restart had no effect.

Any ideas how to fix this?

like image 821
Erik Schulze Avatar asked Jun 06 '16 20:06

Erik Schulze


3 Answers

You need to add this dependency in your build.gradle(app)

compile 'com.firebase:firebase-client-android:2.5.0'
like image 97
vaishakh nambiar Avatar answered Nov 15 '22 06:11

vaishakh nambiar


Now with New Android Studio ,Its so easy to add Firebase to your Project.

Below are Simple Steps-

1. On Android Studio’s Tools menu, you’ll see an entry that reads Firebase.

Tools>Firebase

2. Select this, and a Firebase Assistant pane will open to the side of your code editor:

FirebasePanel

3. On this pane, click the arrow beside ‘Authentication’, and you’ll see a step through for ‘Email and Password Authentication’.

Email Auth

4. Click the ‘Connect to Firebase’ button.

Your browser will open with a ‘Request for Permissions’ dialog: enter image description here

5.Click ‘Allow’, and then after a ‘Success!’ screen, you’ll be given a dialog with which to connect to Firebase.

enter image description here

6.You will see Connected .Its Done !

enter image description here

For more on Firebase refer here.

like image 43
karanatwal.github.io Avatar answered Nov 15 '22 07:11

karanatwal.github.io


You can open and use the Assistant window in Android Studio by following these steps:

  1. Click Tools > Firebase to open the Assistant window. And it will guide you for sync firebase and your project.
like image 4
Emre Türker Avatar answered Nov 15 '22 05:11

Emre Türker