I am trying to connect Firebase with my app and I was following all the steps in this link.
I have the latest Google Repo and android studio 2.2.3, but when I open the Tools drop down menu there is no Firebase option.
Any idea of what I am missing?
In the Android Studio, go to File -> Settings, click on Plugins and then enable all Firebase plugins.
This image below should help.
First you need to sign in to your Google account by clicking on the icon in the upper right corner of android studio. Then the Firebase item will appear in the Tools menu.
In android studio 3.6.1 I used the long way but it worked as shown below:
Log in to Android Studio 3.6.1 from the to right user icon
Log in to firebase console with the same account address
On the firebase console start a new project
In the center of the project overview page, click the Android icon (plat_android) to launch the setup workflow.
5.Enter your app's package name in the Android package name field
Add the Firebase Android configuration file to your app by:
Click Download google-services.json to obtain your Firebase Android config file (google-services.json).
Move your config file into the module (app-level) directory of your app.
To enable Firebase products in your app, add the google-services plugin to your Gradle files.
In your root-level (project-level) Gradle file (build.gradle), add rules to include the Google Services Gradle plugin. Check that you have Google's Maven repository, as well.
11
`buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}`
11
.In your module (app-level) Gradle file (usually app/build.gradle), apply the Google Services Gradle plugin:
apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}
Add Firebase SDKs to your app
To your module (app-level) Gradle file (usually app/build.gradle), add the dependencies for the Firebase products that you want to use in your app.
dependencies {
// ...
// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.3.0'
// Add the dependencies for any other Firebase products you want to use in your app
// For example, to also use Firebase Authentication
implementation 'com.google.firebase:firebase-auth:19.3.0'
// Getting a "Could not find" error? Make sure that you've added
// Google's Maven repository to your root-level build.gradle file
}
Sync your app to ensure that all dependencies have the necessary versions.
If you added Analytics, run your app to send verification to Firebase that you've successfully integrated Firebase. Otherwise, you can skip the verification step.
Your device logs will display the Firebase verification that initialization is complete. If you ran your app on an emulator that has network access, the Firebase console notifies you that your app connection is complete.
In Android Studio 3 , Go To Tools - > Android - > SDK Manager - > under that plugins in which search Firebase and there are three plugins click all then your android studio restart and can see Firebase Assistant there under tools ... Enjoy
Android Studio 3.4.1, Go to Tools -> Firebase
Related
I'm implementing app distribution for android with github actions, everything seems to be okay but I'm getting an error:
* What went wrong:
Execution failed for task ':app:appDistributionUploadQaRelease'.
> Missing app id. Please check that it was passed in and try again
I'm using google play plugin so it should get the app id automatically.
https://firebase.google.com/docs/app-distribution/android/distribute-gradle#step_3_configure_your_distribution_properties
appId -- Your app's Firebase App ID. Required only if you don't have the Google Services Gradle plugin installed.
I have google-services.json file in app module,
in root build.gradle:
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.0'
in app's build.gradle:
plugins {
....
id 'com.google.gms.google-services'
id 'com.google.firebase.appdistribution'
}
in qa flavour:
productFlavors {
....
qa {
applicationId "custom.package.for.qa"
....
firebaseAppDistribution {
releaseNotes = "something 123"
groups = "testers"
}
}
}
if I add "appId = ...." inside firebaseAppDistribution, the build is uploaded successfully. but this shouldn't be necessary because of google play plugin.
and in github action:
- name: Build & Deploy
run: |
export FIREBASE_TOKEN=${{ secrets.FIREBASE_TOKEN }}
./gradlew --stop
./gradlew clean
./gradlew assembleQaRelease appDistributionUploadQaRelease
Thanks!
I also confirm it's a bug in the latest version of their library:
com.google.firebase:firebase-appdistribution-gradle:3.0.0
I opened an issue on their GitHub so hopefully they will fix it soon.
It's a bug in 3.0.0 which fails in some cases.
So temporarily downgrade to: com.google.firebase:firebase-appdistribution-gradle:2.2.0
I had the same issue with 3.0.0 but on Bitbucket pipelines using Service account for upload. Same build just with updated to 3.0.0 fails, with 2.2.0 is Ok.
Because Google don't provide Changelog for Firebase app distribution, we can't validate if they change something in configuration. It looks, that App distribution stops searching for AppId in google-services.json file.
Reply from Google:
I just received feedback from our engineering team. Our investigation
confirms that this is a bug, and because of this, we apologize for the
impact that this may have caused during your distribution process.
They're working on rolling out a fix for this issue, but this will
most likely be available in a newer version of the SDK. We won't be
able to share any timelines at the moment that would confirm exactly
when this bug will be fixed. For now, you can regularly check for
updates on our release notes, or from the main issue thread in GitHub.
I got a reply from firebase support, unfortunately it DOES NOT work for me still, but he was able to reproduce the issue and then resolved it by doing the following, hopefully it will fix it for someone else :
Add the Firebase SDK plugins in your build.gradle (project) file. See Figure 1.0.
Apply the Firebase SDK plugins in your build.gradle (app) file. See Figure 2.0.
Make sure that you have a google-services.json file in your app folder.
Rebuild and Upload your APK to Firebase App Distribution using the commands below:
In a terminal window, run gradlew assembleDebug.
In a terminal window, run gradlew appDistributionUploadDebug.
Figure 1.0 - build.gradle (project)
buildscript {
// …
dependencies {
// Firebase SDK - Plugins
classpath 'com.google.gms:google-services:4.3.10' // Google Services
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.0' // App Distribution
}
}
Figure 2.0 - build.gradle (app)
plugins {
// …
id 'com.google.gms.google-services' // Google Services
id 'com.google.firebase.appdistribution' // App Distribution
}
android {
// …
buildTypes {
debug {
firebaseAppDistribution {
artifactType="APK"
releaseNotes="..."
testers="..#gmail.com"
}
}
}
// …
}
dependencies {
// …
implementation platform('com.google.firebase:firebase-bom:29.0.4') // bom
implementation 'com.google.firebase:firebase-analytics-ktx' // analytics
}
I have my project set to exactly this, but for some reason github actions still fails with missing id.
Adding the google-services plugin worked for me. I'm using the firebase-appdistribution-gradle:3.0.1
Two flavors but just i need to use Analitic-kit in: online flavor (when comment all about analitic-kit can build ),i need rigth way ,(thank you any suggestions)
Trying this
app
/src
/main
/online
agconnect-services.json
/offline
I get
HAPlugin cannot find "agconnect-services.json" in path: "C:\Users\XL\AndroidStudio\ProjectDemoWithAnalitic\app". Please check the file.*
****
dependencies {
classpath 'com.huawei.agconnect:agcp:1.4.0.300'
classpath 'com.huawei.hms.plugin:analytics:5.0.1.300'
}
Solution:
Please remove the following code:
classpath 'com.huawei.hms.plugin:analytics:5.0.1.300'
apply plugin:'com.huawei.hms.plugin.analytics'
Description:
Based on the Analytics Kit Integration Documentation, the HMS Core SDK integration consists of the following steps:
Add the AppGallery Connect configuration file of the app to your Android Studio project.
Add the Maven repository address and Analytics service dependencies in the build.gradle file of your project.
maven {url 'https://developer.huawei.com/repo/'}
classpath 'com.huawei.hms.plugin:analytics:5.0.1.300'
Add the plug-in configuration and SDK version to the build.gradle file in the app directory.
apply plugin:'com.huawei.hms.plugin.analytics'
implementation 'com.huawei.hms:hianalytics:5.0.1.301'
Click Sync Now or Sync Project with Gradle Files to build a project.
The function of the plug-in is to check whether the integration with Analytics is complete. Besides, the plug-in does not support the flavor. Therefore, if you use flavors, you are advised not to use the analytics plug-in.
This question already has answers here:
Android Error when communicating with the Firebase Installations server API
(17 answers)
Firebase cannot communicate with Firebase Server
(4 answers)
Closed 2 years ago.
Firebase-Installations: Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.
You shall configure Firebase with your options as described here:
Add the Firebase Android configuration file to your app:
a. Click Download google-services.json to obtain your Firebase Android config file (google-services.json).
b. Move your config file into the module (app-level) directory of your app.
To enable Firebase products in your app, add the google-services plugin to your Gradle files.
a. In your root-level (project-level) Gradle file (build.gradle), add rules to include the Google Services Gradle plugin. Check that you have Google's Maven repository, as well.
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
b. In your module (app-level) Gradle file (usually app/build.gradle), apply the Google Services Gradle plugin:
apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}
I want to completely disconnect my app from Firebase. This question has been asked several times (e.g here). Most of the answers focus on disconnecting an app from Firebase within the Firebase console and not within Android studio.
After disconnecting my app from the Firebase console. Everytime I try to reconnect the app to another Firebase project, an error balloon pops up stating that the app is already part of a Firebase project. I know this behaviour occurs because some files from the old Firebase project are still present. How do I get rid of them?
Try these steps to remove Fire-base from Android Studio project.
Delete google-services.json file from the Project (Find the file by Project view)
Remove dependencies from Project-level build.gradle (/build.gradle)
buildscript {
dependencies {
// Remove this line
classpath 'com.google.gms:google-services:4.2.0'
}
}
Remove all the Fire-base related dependencies from the project App-level build.gradle (//build.gradle) file
dependencies {
// Remove this line
implementation 'com.google.firebase:firebase-core:17.0.0'
}
Remove the line below from the bottom of the App-level build.gradle (//build.gradle) file
apply plugin: 'com.google.gms.google-services'
Restart Android Studio
Try this, On the project level, delete the google-services.json file
and then sync the project
You should undo all the steps that you are instructed to perform in the manual integration. So, remove all Firebase dependencies from build.gradle, remove the Google Services plugin from the bottom of build.gradle, and remove the google-services.json file.
Try shutting down the Firebase project created with the package name of the connected application; although it doesn't delete at the same time and is scheduled for later. Don't link your android app with any other firebase app till the previous connected app has been deleted completely.
Do the following (If you want to Switch Firebase Data Sources):
In Android Studio, Go to Tools>Firebase, Choose any of the options such as Real time-database
Click Connect to Firebase.
You will get a warning that the App is already connected to Firebase.
Click okay.
Android Studio will open a Firebase console on a browser.
Choose the Firebase App you want to you want to connect to.
Done.
On the main menu, select app ,select ,google-services.json' and then right click then delete
I have Added Firebase to android app for push notification. I have updated build.gradle before i have used. Its working fine.
compile 'com.google.firebase:firebase-messaging:9.2.0'
now i have updated to latest library but getting error.
dependencies {
//....
compile 'com.google.firebase:firebase-core:10.0.1'
}
I had getting error at the time of Rebuild project
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not find com.google.firebase:firebase-core:10.0.1.
Required by:
DGApp:app:unspecified
Thank you in advance.
You have to update your Google Play Services and Google Repository from the Standalone SDK Manager.
Edit: As of the latest version of Android Studio the Standalone SDK Manager is removed. You must go to the SDK Tools tab.
First off, open Android Studio and click this icon at the top toolbar:
Then, when the dialog launches, click "Launch Standalone SDK Manager" at the bottom left of the dialog:
To make sure nothing other than what we want gets updated/installed, click "Deselect All":
When the Standalone SDK Manager window opens, look for "Extras" and collapse it. You should see "Google Play Services" and "Google Repository" and on the right you should see "Update Available: {something}". Select these to items and click "Install".
When they're done installing, the error will go away.
Add the google-services plugin
In build.gradle file, to include the google-services plugin:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-core:10.0.1'
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
More details refer Firebase setup
If you read documentation they are indicating you update your latest Google Repository in the Android SDK manager
So just go to Android SDK Manager and install the latest version of below two libraries
1-Google Play Services
2-Google Repository
Check the image from documentation:
Getting a "Could not find" error? Make sure you have the latest Google Repository in the Android SDK manager.
To reseolved the problem;
Open SDK Manager and update the SDK Tools for latest especially Google APIs under Android 7.0(API 24)
May be you are not giving the right repo.
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}