Firebase UI Database Implementation - android

Tried to add Firebase UI implementation
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
in build.gradle file.
The following error was shown.
*ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.firebaseui:firebase-ui-database:6.2.0.
Affected Modules: app*
Please guide me how to resolve the issue.
I am using Android Studio 3.5.3
Other dependencies I have already implemented in the app
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'

You need to update the following dependencies:
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
to
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0
Also upgrade to androidX. Check the following for more information:
From the docs:
FirebaseUI version 6.0.0 has no breaking API changes from version 5.1.0 but updates critical dependencies to new major versions.
There are two major groups of changes:
Convert all Android Support Library dependencies to AndroidX or Jetpack dependencies. For information on migrating to AndroidX see this guide.
Update all Firebase and Google Play services dependencies to their latest major versions. For information on changes included in these SDKs visit the release notes.

You can follow these steps:
Press F4 to open Module settings
Select Dependency
Click Add new dependency
Type firebase, search for firebase.ui and add its latest dependency.

At last I was able to sync successfully without Error.
The final dependencies in the build.gradle file of the app.
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.firebaseui:firebase-ui-database:6.2.0'

Related

How to build unity project with firebaseUI from android library elegantly

I'm trying to create a game with firebase google and facebook login. I know that it is possible to use firebase with unity, but I don't want to create both login methods separately, when something like FirebaseUI exists.
So I've created android plugin with FirebaseUI authentication. I tested it in new android project and everything works fine. But when I use my plugin in unity, I have to add my own gradle (mainTemplate.gradle) with dependencies for firebaseUI.
Problem is that there is a default value in firebase auth library and when the game is built, values from my library (default_web_client_id etc.) is overwritten by default value.
Almost after week I found a solution, but I hope there is another way.
My solution: Build android library with firebase, copy library (.aar) to Assets/Plugins, export unity project with this library to Idea, then copy the entire file values.xml (that is created from google-services.json) and facebook appId to res folder in exported project. (then build from Idea)
It's working, but by this method, I have default_web_client_id 3 times in project (1x from my library, 1x from FirebaseUI dependency and 1x from copied values.xml, that overrides them). It's not a problem, but I think that it's not necessary.
Is there any more elegant way to work with firebaseUI and android libraries?
mainTemplate (dependency part):
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "android.arch.lifecycle:viewmodel:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.facebook.android:facebook-android-sdk:4.41.0'
**DEPS**}
after some more experiments I found that it depends on implementation order, so I moved **DEPS** up and now its working.
So the solution is easy:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "android.arch.lifecycle:viewmodel:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.facebook.android:facebook-android-sdk:4.41.0'
}
Hope that this helps somebody.

dependencies error when add firebase libraries

When add firebase in
dependencies
implementation 'com.google.firebase:firebase-core:16.0.6'
Or
implementation 'com.google.firebase:firebase-ads:17.1.2'
Or
implementation 'com.google.android.gms:play-services-ads:17.1.1
It shows error under implementation 'com.android.support:appcompat-v7:28.0.0' that All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
When I sync the app no error but when install the app it shows you app has been stopped (Crashing during run time).
When remove the firebase dependencies and run, my app it's working fine.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}
apply plugin: 'com.google.gms.google-services'
When you include dependencies, they too, will sometimes include dependencies of their own. Some of the firebase libraries happen to include support libraries at a lower version than 28. When you hover over the error message for appcompat-v7 it should tell you what library is lower than 28. You may have to click 'show more' on the error message. Once you figure out which one it is, include that exact same library but version 28. Resync your gradle and you're good to go. Also, you might have to do this multiple times because some firebase libraries include multiple lower version support libraries and the error message will only show you one library at a time.

Sync error while syncing firebase database with app

I used the firebase tool available in android studio to sync my app with firebase database. After connecting to firebase, I had to add realtime database. Sync failed and the following error showed.:
Failed to resolve: firebase-database-15.0.0
The line:
implementation 'com.android.support:appcompat-v7:28.0.0'
Has red underline and when I hover the mouse over it, it shows all android.support libraries must have same exact version specification.
The sync is failing, although I am using the assistant to add the dependencies Why is it so?
I searched on google where it said to change :
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
to :
implementation 'com.google.firebase:firebase-database:16.0.1'
But doing so removes the database from the app.The dependencies are:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
}
i had faced the same issue before .If their is the update available then update your android it will fix it.
from my experience when i use the assistant to add the dependencies then it comes like this
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0' but the it is not correct update it with this
implementation 'com.google.firebase:firebase-database:16.0.1' or
implementation 'com.google.firebase:firebase-database:15.0.0' or this
maybe this will help you

failed to resolve : Firebase auth 15.0.0

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.firebase:firebase-client-android:2.5.2+'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.volley:volley:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
}
I don't know but the error only shows the appcompat 28.0.0 won't work.
Change
this, implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
to this, implementation 'com.google.firebase:firebase-auth:16.0.1'
and better, update all dependencies to the latest versions
The following dependency is put in by the Firebase Assistant to "Add Firebase Authentication to the App"
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
If you remove 15.0.0, and make it
implementation 'com.google.firebase:firebase-auth:16.0.1'
that automatically removes Firebase Authentication in the Firebase Assistant, beating the whole purpose. Also if you change to the '...firebase-auth:16.0.1:15.0.0' to the latest version '...firebase-auth:16.1.0:15.0.0', nothing happens to the error, as it is due to the '15.0.0' part.
This is probably a blocker bug from Firebase or Google side, which could be only corrected by them. Hope this catches their attention soon. Otherwise all new developments using this version of Firebase Auth or Database will be stalled. Older versions may be working though.

The library com.google.firebase:firebase-analytics is being requested by various other libraries

I am getting this error when updating the Firebase libraries:
The library com.google.firebase:firebase-analytics is being requested
by various other libraries at [[15.0.1,16.0.0), [16.0.1,16.0.1],
[16.0.1,99999]], but resolves to 16.0.1. Disable the plugin and check
your dependencies tree using ./gradlew :app:dependencies.
Dependencies are:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-invites:16.0.1'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.2'
Is there a simple way to find the correct configuration?
If not, what plugin is to be disabled and how? if i just run the task i get the same error.
Update:
i think this dependency has something to do it with, because if disable it's pluging the depedency task runs:
implementation 'com.google.android.gms:play-services-auth:15.0.1'
Try using these steps:
Update your implementation versions (for the newest firebase versions see the release notes https://firebase.google.com/support/release-notes/android)
Update your project build.gradle file with the newest google-services version (at the moment classpath 'com.google.gms:google-services:4.0.1)
Or see this similar post

Categories

Resources