Android firebase failed build.gradle implementation - android

I'm in the final stages putting my project on cloud firebase. Added all required firebase requirements using the firebase console. The Android compile fails with the error: Could not find com.google.firebase:firebase-appcheck-playintegrity:.
This is a copy of the implementation in the build.gradle file:
implementation 'com.google.firebase:firebase-appcheck-playintegrity'
Is this the correct statement for these dependencies? I assume there is no version number. This project is my first attempt putting a project on the cloud firebase. Appreciate any help.
Roger

As per the documentation:
https://firebase.google.com/docs/app-check/android/play-integrity-provider?authuser=0#install-sdk
You don’t need to specify version only if you also defined BoM dependency. Otherwise version is required.
dependencies {
// Declare the dependency for the App Check library
// When NOT using the BoM, you must specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-appcheck-playintegrity:16.0.0'
}

Related

IllegalArgumentException when update firebase library

My Android app work fine before I update firebase libs. After updating to the newest firebase lib I got following Exception:
E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.sound.booster.extra.volume, PID: 24298
java.lang.IllegalArgumentException: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google.
at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(Unknown Source:8)
at com.google.firebase.iid.FirebaseInstanceId.zza(com.google.firebase:firebase-iid##20.1.7:52)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(com.google.firebase:firebase-iid##20.1.7:2)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(com.google.firebase:firebase-iid##20.1.7:1)
Src before update libs:
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-config:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
Src after update libs:
implementation 'com.google.firebase:firebase-messaging:20.1.7'
implementation 'com.google.firebase:firebase-config:19.1.4'
implementation 'com.google.firebase:firebase-core:17.4.1'
implementation 'com.google.firebase:firebase-analytics:17.4.1'
Could anyone explain why and how to fix this issue?
Newer versions of the Firebase SDKs depends on a service called Firebase Installations Service, which adds some extra requirements on the configuration data about the Firebase project that you include in your application. In your case it seems that you're missing a project ID in this configuration.
If you configure the Firebase project for your app by including a google-services.json in your app, the solution is typically to get the latest version of that file from the Firebase console and update in your app.
If you configure the Firebase project for your app explicitly in code, you will need to make sure that you call the setProjectId method in there.
Also see:
FirebaseInstallationsException on latest version
Firebase cannot communicate with Firebase Server
the release notes of the SDK version where this new dependency was introduced

Error in android gradle plugin : it must have dependency on com.google.firebase:firebase-core for firebase service to work as intended

The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended
Your error clearly says that you're missing the Firebase Core library in your app/build.gradle.
Follow the steps below on how to set up Firebase in your app. Don't forget to add
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.9'
// Getting a "Could not find" error? Make sure that you've added
// Google's Maven repository to your root-level build.gradle file
}
In your app/build.gradle file if you've already followed all the steps correctly.

Firebase Warning to use firebase-core library when using firebase-messaging library

I am using firebase:firebase-messaging library for push notification. While building the application I am seeing a warning which says
Warning: The app Gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended.
Release notes by firebase say
https://developers.google.com/android/guides/releases#may_23_2018
Firebase now requires the app Gradle file to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.
Firebase-core library is used for analytics, what will happen if I don't include this library? I am already using gms:play-services-analytics.
Also, I have found the library version for both gms:play-services-analytics must be the same as firebase:firebase-core library to avoid any build error.
Something like below
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
Will there be any impact on the application if I will include firebase:firebase-core library in application gradle along with gms:play-services-analytics?
Why firebase is showing the above warning ?
What will be impacted if I don't include firebase-core with firebase-messaging library? A warning can be ignored?
Is this due to firebase adding analytics for all its features?
Here: https://support.google.com/firebase/answer/6383877?hl=en
If you don't include com.google.firebase:firebase-core, then you won't be able to use the other firebase services like firebase-database or firebase-messaging.
If you are using google-service version 3.2.1+, then you can use different library versions for gms:play-services-analytics and firebase:firebase-core.

Android Studio cannot find Firebase

I'm trying to get the Android P preview setup, and in the process I am upgrading all my dependencies, but it gets mad when Firebase and Google Play Services don't match versions. (It wont build). The latest version of Google Play Services is 15.0.1 as denoted here. The latest version of Firebase is version 16.0.0, according to this page. So I figured I should use 15.0.1 for all of them. However Android Studio can't seem to resolve any version of Firebase. It always gives me an error like this:
It gives the same error for any version I give it.
Here are my dependencies:
implementation 'com.google.firebase:firebase-core:15.0.1'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
Try to update firebase like below:
implementation 'com.google.firebase:firebase-core:16.0.0'
Also make sure that you use latest google service:
classpath 'com.google.gms:google-services:4.0.1'
From docs you are linked to you can find annotation
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
The firebase-core library wasn't released at version 15.0.1. You can see via http://maven.google.com that you should use either 15.0.2 or 16.0.0 (my suggestion is to always use 16+ libraries when they exist b/c we're removing version ranges from the POM files (therefore, you'll go back to hermetic builds). The May 23rd entry of our release notes goes into more details, if needed. (https://developers.google.com/android/guides/releases)
The assumption that all of the libraries should be used at the same version is no longer valid as of versions 15.0.0 and greater. Libraries will continue to release independently and with ever-diverging version numbers (following a SemVer.org scheme).

Adding Firebase UI to android studio

I need to get a hands-on on firebase list and recycler adapters. I've added the required firebase ui dependency but for reasons unknown to me, I keep getting this error:
Failed to resolve: com.firebase:firebase-ui:0.3.1
I've throttled the dependency version back and forth(0.1.0,0.3.1, 0.4.0) and neither of them works for me. I could use some help here.
What is the google play services version of yours.
if 9.8.0, use below for compatibility reasons
compile 'com.firebaseui:firebase-ui:1.0.0'
https://github.com/firebase/firebaseui-android#using-the-library-in-your-android-app
In the app's build.gradle I add to the firebase core library to the dependencies :
compile 'com.google.firebase:firebase-core:9.8.0'
Then depending which modules of firebase I want to use in addition, I add those in too, such as:
compile 'com.google.firebase:firebase-ads:9.8.0'
To use FirebaseUI, you need to add some dependencies:
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
// Required only if Facebook login support is required
implementation('com.facebook.android:facebook-android-sdk:4.33.0')
// Required only if Twitter login support is required
implementation("com.twitter.sdk.android:twitter-core:3.1.1#aar") { transitive = true }
Here is more information: FirebaseUI-android

Categories

Resources