3

Edit: This question refers to Flutter apps.

When adding Firebase to my Android app, the instructions say: "Finally, press "Sync now" in the bar that appears in the IDE"

enter image description here

However, no bar appears in Android Studio.

It seems that there used to be a button in the tool bar: Where is a "Sync project with gradle files" button in Android Studio 3?

And that more recently it could be found at "File > Sync Project with Gradle Files": Syncing Android Studio project with Gradle files

But neither of those options exist in Android Studio as of April 4, 2020. The closest thing I can find is an item in the dropdown menu that says "Sync with File System."

enter image description here

I thought maybe it was the same thing, but they are not: What is the difference between Sync project with gradle files and Sync with File System?

Any ideas how I can sync project with gradle files in Android Studio in April 2020?

Thank you!

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
Derence
  • 408
  • 5
  • 18

2 Answers2

2

According to your picture, it looks like you are using flutter and not native android development. If you want to add firebase analytics to your flutter app then you need to go to the pubspec.yaml file, and you can add the dependency:

dependencies:
  firebase_analytics: ^5.0.11

After adding it a top bar will appear to that will automatically execute pub get

https://pub.dev/packages/firebase_analytics#-installing-tab-

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • Thanks for your answer! Yes, it is in Flutter. Just a moment before you answered I tried this: https://stackoverflow.com/a/60260032/10336149 and it seems to have worked. After I clicked next and ran my app, it said something like "Congrats! Your app in now connected to Firebase." I assume I will also need to add the firebase_analytics: ^5.0.11 package to the pubspec.yaml file, but for future reference, is adding the package all that needs to be done? In other words, is that entire process in the Firebase console (https://firebase.google.com/docs/android/setup#console) unnecessary? – Derence Apr 04 '20 at 20:01
  • 1
    You should follow this https://firebase.google.com/docs/flutter/setup when cresting a flutter project with firebase. The `google-services.json` and adding the `google-services` in build.gradle are necessary, and yes you also need to add the plugins, if lets say you want to use firestore then you have to add the cloud firestore plugin also – Peter Haddad Apr 04 '20 at 20:12
1

what I do is open the android folder of our Flutter project as a new project,

** Archivo> Abrir> Proyect-android **

in this way the IDE recognizes it, and enables the Gradle synchronization button ( only enabled in native android projects)

Image Example

once synced, you can close the native Android project, and it would be synced to your Flutter project