Faild to resolve: firebase-auth-15.0.0 - android

I am new to android development environment and I need to connect my app to firebase but I am getting this error
Failed to resolve: firebase-auth-15.0.0
This error is shown in the statement:
implementation 'com.google.firebase:firebase-auth:15.0.0' //16.0.1
I tried to change the above statement to
implementation 'com.google.firebase:firebase-auth:16.0.3'
But then firebase dependency is not setting up.

You should use firebase-auth:16.0.4 version.
implementation 'com.google.firebase:firebase-auth:16.0.4'
FYI
At first, add rules to your root-level build.gradle file, to include the google-services plugin and the Google's Maven repository:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.1.0' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
After that, Clean-Rebuild-Run.
Read Add Firebase to Your Android Project

Update the dependency to the following:
implementation 'com.google.firebase:firebase-auth:16.0.4'
Also add firebase-core:
implementation 'com.google.firebase:firebase-core:16.0.4'
https://firebase.google.com/support/release-notes/android
Please also update google-services plugin in top level gradle file:
classpath 'com.google.gms:google-services:4.1.0'

Related

After upgrding to com.google.gms:google-services:3.3.0 I started geting this errors [duplicate]

I am getting the following error:
Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution.
Updated:
I am able to build using com.google.gms:google-services:3.3.0 when data binding is disabled, but this is not a solution for someone that requires data binding to be enabled.
After Google announced the new sdk versioning system (link), I did the following steps:
I updated the gradle files as directed to include the gms and firebase version numbers separately. Updated the apply plugin line, updated the classpath. I am still getting the error and dont know the reason.
Below are relevant gradle files:
build.gradle (main):
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/rvalerio/maven' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'io.realm:realm-gradle-plugin:4.3.3'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
}
}
build.gradle (Module:app)
apply plugin: 'com.google.gms.google-services'
Firebase dependencies:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true
}
GMS and other dependencies
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:support-v13:27.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-vision:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
I have pasted the error log on pastebin from android studio 3.1.2 here.
Any help is appreciated!
managed to build against Play Services & Firebase 15.0.0 with data-binding enabled ...my dependencies now look about alike this and it builds again, without any Cannot change dependencies of configuration complaints:
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:3.1.2"
// do not update, because 3.3.1 appears broken
// classpath "com.google.gms:google-services:3.2.1"
// meanwhile, there is version 4.0.2 available
classpath "com.google.gms:google-services:4.0.2"
}
}
one has to reference all the libraries individually. just referencing com.google.android.gms:play‐services and/or com.google.firebase:firebase-core does not work anymore since 15.0.0.
android {
dependencies {
// Play Services 15.0.0
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-identity:15.0.1"
// Firebase 15.0.0
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-database:15.0.1"
implementation "com.google.firebase:firebase-firestore:16.0.0"
implementation "com.google.firebase:firebase-storage:15.0.2"
implementation "com.google.firebase:firebase-crash:15.0.2"
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation "com.google.firebase:firebase-invites:15.0.1"
implementation "com.google.firebase:firebase-ads:15.0.1"
implementation "com.google.firebase:firebase-appindexing:15.0.1"
implementation "com.google.firebase:firebase-perf:15.2.0"
implementation "com.google.firebase:firebase-functions:15.0.0"
}
}
apply plugin: 'com.google.gms.google-services'
also had to edit the Manifest.xml to fix the support library:
<application>
<meta-data
android:name="android.support.VERSION"
android:value="27.1.1"
tools:replace="android:value"/>
</application
The issue with data binding and the 3.3.0 version of the google-services plugin has been reported here: https://issuetracker.google.com/issues/79122163
As of today, the bug is in the "assigned" state.
UPDATE
I could compile also with
dataBinding.enabled false
In android configuration and version 3.3.0
ORIGINAL
Same problem here with google-services:3.3.0, which is the last version, but according to docs version 3.2.1 should be used. I've been able to compile with the following
ext {
kotlin_version = '1.2.41'
firebaseCore = '15.0.2'
authentication = '15.1.0'
cloudFirestore = '16.0.0'
cloudStorage = '15.0.2'
crashlitics = '2.9.1'
googleServices = '15.0.0'
supportLibrary = '27.1.1'
facebookSdkVersion = '4.31.0'
twitterSdkVersion = '3.1.1'
firebaseUI = '3.3.1'
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.2.1'
}
This issue seems to have been resolved by using the new google-services release (4.0.1 as of today). Below is the relevant versions that will resolve the stated issue:
In your project build.gradle files:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1' }
In your app build.gradle files:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-config:16.0.0"
implementation 'com.google.firebase:firebase-perf:16.0.0'
...} apply plugin: "com.google.gms.google-services"
Databinding is set to true as well:
dataBinding {
enabled = true
}
Android Studio version: 3.1.2
Thank you all for providing various ways you can get around the problem, such as the answer by #Kyle and the medium post link that shows you how to use firebase without google services.
Just downgrade your GooglePlay services dependency to 3.2.1 :)
classpath 'com.google.gms:google-services:3.2.1'
While not a great solution, I followed the recommendation from a Googler mentioned on the bug tracker.
I am using
com.google.gms:google-services:3.3.1
I have enabled databinding
`dataBinding.enabled true`
I removed the plugin reference from the app gradle script
//apply plugin: 'com.google.gms.google-services'
And followed the recommendations from this Medium post to include all of the necessary Google Service string values.
https://medium.com/#samstern_58566/how-to-use-firebase-on-android-without-the-google-services-plugin-93ecc7dc6c4
My app builds successfully and everything works as expected.
Everything worked after I added the google() maven inside the allProjects block in my project build.gradle like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
...
}
}
repositories {
...
}
// You need to add the google maven in this block.
allprojects {
repositories {
jcenter()
google()
}
}

Gradle sync fails - play-services-measurement-base

I have a problem on my Android project, I can't build, this is the error I have:
Failed to notify dependency resolution listener.
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.2,15.0.2], [15.0.4,15.0.4]], but resolves to 15.0.4. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
I tried many different solution I found but the problem persists.
I have the right dependencies and repositories on gradle file on project root:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
}
and
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
On my app gradle I have the following dependencies:
implementation "com.google.android.gms:play-services-maps:15.0.1"
implementation "com.google.android.gms:play-services-places: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-analytics:15.0.2"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-tagmanager:15.0.2"
implementation "com.google.firebase:firebase-core:16.0.0"
Some suggestions?
The solution was update the following dependencies:
implementation "com.google.android.gms:play-services-analytics:16.0.0"
implementation "com.google.android.gms:play-services-tagmanager:16.0.0"
I just added right after the apply plugin: 'com.google.gms.google-services' at the bottom of my build.gradle :
apply plugin: 'com.google.gms.google-services'
// Work around
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
I had the same exact error, upgrading analytics was the key:
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
I know you thought everything is updated referring to the official website, but writing 15.0.0 and looking for suggestions works better.
Update project gradle play service dependency with latest release :
classpath 'com.google.gms:google-services:4.0.1' and
Update project firebase products usage as per firebase latest release note
this shoud be on top if you use firebase libraries:
implementation "com.google.firebase:firebase-core:16.0.0"
This worked for me.this shoud be on top if you use firebase libraries:
implementation "com.google.firebase:firebase-core:15.0.0"
In my case the issue was OneSignal, which somehow broke everything down.
They even have a dedicated library for this: https://github.com/OneSignal/OneSignal-Gradle-Plugin
and the actual issue was that OneSignal was inside my app-level gradle, instead of root one.
Freaking ridiculous!
Check Answer by Bhupendra Acharya from
https://groups.google.com/forum/#!topic/firebase-talk/XbGR-YrsTTA works for you. I got the following error
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
While using
implementation 'com.google.firebase:firebase-core:16.0.1'
And resolved by updating the version
implementation 'com.google.firebase:firebase-core:16.0.4'
My problem was that I was importing oneSignal gradle plugin but I do not import the full apply plugin: 'com.google.gms.google-services'.
To fix I just had to add the implementations I was using.
For future users: Open build.gradle files and just hover your mouse on the dependencies and a tooltip gonna show up telling your the newest version and that should solve your problem.
Beware that Firebase Documentations does not have the newest versions.
update classpath for com.google.firebase:firebase-core:16+
classpath 'com.google.gms:google-services:4.2.0'
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
Try this one , place maven url on top inside repositories in build.gradle
Update build.gradle
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2' //< update version
classpath 'com.google.gms:google-services:3.1.1' //< update version
}
}
This would help you I guess
Update the build.gradle file from the project root folder. I've tried this and it was helping.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
----
}}
Make sure you added following line in bottom of app gradle
apply plugin: 'com.google.gms.google-services'
Make sure you are using compatible google-services in project level gradle
dependencies {
classpath 'com.google.gms:google-services:4.0.1'
}
Check if you have added following dependency
implementation 'com.google.firebase:firebase-core:16.0.1'
I have answered a similar issue here. You need to keep versions of play services and firebase to latest one. Check here for links
https://stackoverflow.com/a/52696667/3333878
Try to set
classpath 'com.google.gms:google-services:3.2.1'
instead of
classpath 'com.google.gms:google-services:4.0.1'
It's helped in my case, but I don't know the cause of the error.

Gradle project sync failing after Google announced the new sdk versioning system

I am getting the following error:
Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution.
Updated:
I am able to build using com.google.gms:google-services:3.3.0 when data binding is disabled, but this is not a solution for someone that requires data binding to be enabled.
After Google announced the new sdk versioning system (link), I did the following steps:
I updated the gradle files as directed to include the gms and firebase version numbers separately. Updated the apply plugin line, updated the classpath. I am still getting the error and dont know the reason.
Below are relevant gradle files:
build.gradle (main):
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/rvalerio/maven' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'io.realm:realm-gradle-plugin:4.3.3'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
}
}
build.gradle (Module:app)
apply plugin: 'com.google.gms.google-services'
Firebase dependencies:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true
}
GMS and other dependencies
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:support-v13:27.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-vision:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
I have pasted the error log on pastebin from android studio 3.1.2 here.
Any help is appreciated!
managed to build against Play Services & Firebase 15.0.0 with data-binding enabled ...my dependencies now look about alike this and it builds again, without any Cannot change dependencies of configuration complaints:
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:3.1.2"
// do not update, because 3.3.1 appears broken
// classpath "com.google.gms:google-services:3.2.1"
// meanwhile, there is version 4.0.2 available
classpath "com.google.gms:google-services:4.0.2"
}
}
one has to reference all the libraries individually. just referencing com.google.android.gms:play‐services and/or com.google.firebase:firebase-core does not work anymore since 15.0.0.
android {
dependencies {
// Play Services 15.0.0
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-identity:15.0.1"
// Firebase 15.0.0
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-database:15.0.1"
implementation "com.google.firebase:firebase-firestore:16.0.0"
implementation "com.google.firebase:firebase-storage:15.0.2"
implementation "com.google.firebase:firebase-crash:15.0.2"
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation "com.google.firebase:firebase-invites:15.0.1"
implementation "com.google.firebase:firebase-ads:15.0.1"
implementation "com.google.firebase:firebase-appindexing:15.0.1"
implementation "com.google.firebase:firebase-perf:15.2.0"
implementation "com.google.firebase:firebase-functions:15.0.0"
}
}
apply plugin: 'com.google.gms.google-services'
also had to edit the Manifest.xml to fix the support library:
<application>
<meta-data
android:name="android.support.VERSION"
android:value="27.1.1"
tools:replace="android:value"/>
</application
The issue with data binding and the 3.3.0 version of the google-services plugin has been reported here: https://issuetracker.google.com/issues/79122163
As of today, the bug is in the "assigned" state.
UPDATE
I could compile also with
dataBinding.enabled false
In android configuration and version 3.3.0
ORIGINAL
Same problem here with google-services:3.3.0, which is the last version, but according to docs version 3.2.1 should be used. I've been able to compile with the following
ext {
kotlin_version = '1.2.41'
firebaseCore = '15.0.2'
authentication = '15.1.0'
cloudFirestore = '16.0.0'
cloudStorage = '15.0.2'
crashlitics = '2.9.1'
googleServices = '15.0.0'
supportLibrary = '27.1.1'
facebookSdkVersion = '4.31.0'
twitterSdkVersion = '3.1.1'
firebaseUI = '3.3.1'
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.2.1'
}
This issue seems to have been resolved by using the new google-services release (4.0.1 as of today). Below is the relevant versions that will resolve the stated issue:
In your project build.gradle files:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1' }
In your app build.gradle files:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-config:16.0.0"
implementation 'com.google.firebase:firebase-perf:16.0.0'
...} apply plugin: "com.google.gms.google-services"
Databinding is set to true as well:
dataBinding {
enabled = true
}
Android Studio version: 3.1.2
Thank you all for providing various ways you can get around the problem, such as the answer by #Kyle and the medium post link that shows you how to use firebase without google services.
Just downgrade your GooglePlay services dependency to 3.2.1 :)
classpath 'com.google.gms:google-services:3.2.1'
While not a great solution, I followed the recommendation from a Googler mentioned on the bug tracker.
I am using
com.google.gms:google-services:3.3.1
I have enabled databinding
`dataBinding.enabled true`
I removed the plugin reference from the app gradle script
//apply plugin: 'com.google.gms.google-services'
And followed the recommendations from this Medium post to include all of the necessary Google Service string values.
https://medium.com/#samstern_58566/how-to-use-firebase-on-android-without-the-google-services-plugin-93ecc7dc6c4
My app builds successfully and everything works as expected.
Everything worked after I added the google() maven inside the allProjects block in my project build.gradle like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
...
}
}
repositories {
...
}
// You need to add the google maven in this block.
allprojects {
repositories {
jcenter()
google()
}
}

how to solve Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution [duplicate]

I am getting the following error:
Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution.
Updated:
I am able to build using com.google.gms:google-services:3.3.0 when data binding is disabled, but this is not a solution for someone that requires data binding to be enabled.
After Google announced the new sdk versioning system (link), I did the following steps:
I updated the gradle files as directed to include the gms and firebase version numbers separately. Updated the apply plugin line, updated the classpath. I am still getting the error and dont know the reason.
Below are relevant gradle files:
build.gradle (main):
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/rvalerio/maven' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'io.realm:realm-gradle-plugin:4.3.3'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
}
}
build.gradle (Module:app)
apply plugin: 'com.google.gms.google-services'
Firebase dependencies:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true
}
GMS and other dependencies
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:support-v13:27.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-vision:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
I have pasted the error log on pastebin from android studio 3.1.2 here.
Any help is appreciated!
managed to build against Play Services & Firebase 15.0.0 with data-binding enabled ...my dependencies now look about alike this and it builds again, without any Cannot change dependencies of configuration complaints:
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:3.1.2"
// do not update, because 3.3.1 appears broken
// classpath "com.google.gms:google-services:3.2.1"
// meanwhile, there is version 4.0.2 available
classpath "com.google.gms:google-services:4.0.2"
}
}
one has to reference all the libraries individually. just referencing com.google.android.gms:play‐services and/or com.google.firebase:firebase-core does not work anymore since 15.0.0.
android {
dependencies {
// Play Services 15.0.0
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-identity:15.0.1"
// Firebase 15.0.0
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-database:15.0.1"
implementation "com.google.firebase:firebase-firestore:16.0.0"
implementation "com.google.firebase:firebase-storage:15.0.2"
implementation "com.google.firebase:firebase-crash:15.0.2"
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation "com.google.firebase:firebase-invites:15.0.1"
implementation "com.google.firebase:firebase-ads:15.0.1"
implementation "com.google.firebase:firebase-appindexing:15.0.1"
implementation "com.google.firebase:firebase-perf:15.2.0"
implementation "com.google.firebase:firebase-functions:15.0.0"
}
}
apply plugin: 'com.google.gms.google-services'
also had to edit the Manifest.xml to fix the support library:
<application>
<meta-data
android:name="android.support.VERSION"
android:value="27.1.1"
tools:replace="android:value"/>
</application
The issue with data binding and the 3.3.0 version of the google-services plugin has been reported here: https://issuetracker.google.com/issues/79122163
As of today, the bug is in the "assigned" state.
UPDATE
I could compile also with
dataBinding.enabled false
In android configuration and version 3.3.0
ORIGINAL
Same problem here with google-services:3.3.0, which is the last version, but according to docs version 3.2.1 should be used. I've been able to compile with the following
ext {
kotlin_version = '1.2.41'
firebaseCore = '15.0.2'
authentication = '15.1.0'
cloudFirestore = '16.0.0'
cloudStorage = '15.0.2'
crashlitics = '2.9.1'
googleServices = '15.0.0'
supportLibrary = '27.1.1'
facebookSdkVersion = '4.31.0'
twitterSdkVersion = '3.1.1'
firebaseUI = '3.3.1'
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.2.1'
}
This issue seems to have been resolved by using the new google-services release (4.0.1 as of today). Below is the relevant versions that will resolve the stated issue:
In your project build.gradle files:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1' }
In your app build.gradle files:
//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-config:16.0.0"
implementation 'com.google.firebase:firebase-perf:16.0.0'
...} apply plugin: "com.google.gms.google-services"
Databinding is set to true as well:
dataBinding {
enabled = true
}
Android Studio version: 3.1.2
Thank you all for providing various ways you can get around the problem, such as the answer by #Kyle and the medium post link that shows you how to use firebase without google services.
Just downgrade your GooglePlay services dependency to 3.2.1 :)
classpath 'com.google.gms:google-services:3.2.1'
While not a great solution, I followed the recommendation from a Googler mentioned on the bug tracker.
I am using
com.google.gms:google-services:3.3.1
I have enabled databinding
`dataBinding.enabled true`
I removed the plugin reference from the app gradle script
//apply plugin: 'com.google.gms.google-services'
And followed the recommendations from this Medium post to include all of the necessary Google Service string values.
https://medium.com/#samstern_58566/how-to-use-firebase-on-android-without-the-google-services-plugin-93ecc7dc6c4
My app builds successfully and everything works as expected.
Everything worked after I added the google() maven inside the allProjects block in my project build.gradle like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
...
}
}
repositories {
...
}
// You need to add the google maven in this block.
allprojects {
repositories {
jcenter()
google()
}
}

How to use the SDK Firebase (Android) in Nativescript

I'm trying to use the sdk Firebase natively on Android but when I try to initialize Firebase using:
com.google.firebase.FirebaseApp.initializeApp(utils.ad.getApplicationContext();
I receive this error
System.err: Error: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process *******. Make sure to call FirebaseApp.initializeApp(Context) first.
in my app.gradle:
dependencies {
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile "com.google.android.gms:play-services-base:11.8.0"
}
can help me?
Add rules to platforms/android/build.gradle file, to include the google-services plugin and the Google's Maven repository:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
}
}
allprojects {
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
Insert firebase dependencies to App_Resources/Android/app.gradle:
dependencies {
compile 'com.google.firebase:firebase-core:11.8.0'
//compile 'com.google.firebase:firebase-messaging:11.8.0'
//compile "com.google.android.gms:play-services-base:11.8.0"
// ...
}
And at the end of App_Resources/Android/app.gradle insert:
apply plugin: 'com.google.gms.google-services'
Finally, if you hit the error:
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Copy manually the google-services.jsonfile:
cp app/App_Resources/Android/google-services.json platforms/android/app/google-services.json
Meanwhile, thank you so much for your reply #attdona :)
I solved by doing more or less what you did.
The only differences are that:
To use a dynamic build.gralde I created a hook to replace the
original one with mine to compile.
Always using a hook I copied
the file google-services.json from App_Resources/Android/ to
platforms/android/app

Categories

Resources