In this post, we will setup Firebase for Android Project for Google Sign-In functionality. For the previous post on setting up a new project in Firebase, click here.
Steps To Setup Firebase For Android Project
I. Click on the android icon option.
II. After selecting android we have to provide android package name, application nickname which is optional and Debug signing certificate SHA-1.
III. For the Android package name, go to your flutter application project –>android–>app–>src–>AndroidManifest.xml. In the very second line you will find the package name. Copy the same package name and paste it in the android package name of Firebase console.
IV. For the nickname you can simply provide any nickname or you can leave it empty.
V. For Google Sign-In Debug signing certificate SHA-1 is the most required. Hover the mouse on the help icon which will take you to the “Authenticating Your Client” page.
Depending upon your platform select the code, copy the code and paste it in the cmd terminal. The command prompt will generate the SHA-1 hash. Copy the hash code and paste it in the “Debug signing certificate SHA-1” field in firebase. Click on Register app. (Note: If you are having trouble creating the SHA-1 hash code, you can use the Firebase provided hash code.)
VI. After Registering the app, download the JSON file named “google-services.json” and click continue.
VII. Now you have to Add firebase SDK to your flutter application. For that add the SDK in Project-level build.gradle which is projectàbuild.gradle.
VIII. Again scroll down and add the plugin in App-level build.gradle which is projectàapp-àmoduleàbuild.gradle.
IX. Click Next and then Continue to console and then you are all done.
X. Now lastly to activate Google Sign-In services, click on the authentication and then press get started. Then you will see the option for google and then click on it. Enable the option and then click save. The setup is completed and you are now ready to code in Flutter.
You must be logged in to post a comment.