I'm following this documentation to add FirebaseUI to my project but I have 2 errors (Failed to find provider info for com.google.android.gms.phenotype & Google Play services missing or without correct permission.)
this error occurs when I write that line at the dependencies :
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
my gradle app :
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation'com.google.firebase:firebase-database:16.0.1'
implementation'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0' // the problem is here ??
//noinspection GradleCompatible
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'
my gradle project :
buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
my logcat :
e08-02 08:48:30.431 8422-8440/com.google.firebase.chat E/ActivityThread: Failed to find provider info for com.google.android.gms.phenotype
08-02 08:48:30.510 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play services missing or without correct permission.
08-02 08:48:30.550 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play services missing or without correct permission.
08-02 08:48:30.927 8422-8445/com.google.chat E/ActivityThread: Failed
to find provider info for com.google.android.gms.chimera
08-02 08:48:31.079 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play services missing or without correct permission.
08-02 08:48:41.128 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play services missing or without correct permission.
To solve this, change the following line of code:
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
to
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
And the following line of code:
classpath 'com.google.gms:google-services:4.0.1'
to
classpath 'com.google.gms:google-services:4.0.2'
And it seems that you also need to add the following line of code:
implementation 'com.google.android.gms:play-services-auth:15.0.1'
This issue seems to be device-related, make sure Google Play services are installed on your testing device.
Check out this solution: https://stackoverflow.com/a/25705181/5892396
You need to keep the versions for all your google services library similar.
Each Firebase UI version corresponds to a particular Google services version .
As per the docs (https://github.com/firebase/FirebaseUI-Android)
As of version 4.1.0, FirebaseUI has the following dependency versions:
Library Version
firebase-auth 16.0.1
play-services-auth 15.0.1
firebase-database 16.0.1
....
Updated :
For the Error "Google Play services missing or without correct permission" , you could try the suggestion in this Link
"Download google play service sdk and add ACCESS_FINE_LOCATION permission in manifest if not added"
I found where the error was.
I changed
compileSdkVersion 24
to
compileSdkVersion 24
Related
My Project Sync is failing with the below errors -
Unable to resolve dependency for ':app#debug/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#release/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
My Project build.grade looks like this -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my App gradle file looks like -
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.android.application"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.0'
}
Any help in this regard would be appreciated!!!
How do I resolve this??
I have tried Invalidate Caches/Restart option and also tried to rebuild the project but it didn't help..
It seems that Exoplayer-core and Exoplayer-dash are broken since today
https://github.com/google/ExoPlayer/issues/5225
By this Gradle configuration it works fine :
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 27
defaultConfig {
...
targetSdkVersion 27
...
}
}
ext {
exoplayer_version = '2.9+'
}
dependencies {
...
//exoplayer
implementation ('com.google.android.exoplayer:exoplayer-core:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-dash:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-hls:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-smoothstreaming:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-ui:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer:' + exoplayer_version)
So for sure if you didn't include exoplayer library in your
build.gradle, your project won't synch.
UPDATE:
Okay, sorry, now I got the problem you all using com.facebook.android:audience-network-sdk have experienced these days, and why in your build.gradle file there is not exoplayer dependency set.
Using com.facebook.android:audience-network-sdk that depends on exoplayer, if you didn't explicitly specify exoplayer-core and exoplayer-dash, gradle try to download the necessary dependency as for docs.
So, as #laylakn pointed out (upvoted for that) there where an issue between repository mirroring between bintray and jcenter.
So, specifically to your problem, since you have told me that you have tried adding the libraries and synch without success, that's because the version of exoplayer you are looking for (r2.4.2) is in the spring plugin repository.
So you should add it as your maven repo (because of the mirroring error of repositories stated before):
maven {
url "https://repo.spring.io/plugins-release/"
}
Or as explain on main GitHub repo, just pointing directly to bintray.
maven {
url 'https://google.bintray.com/exoplayer/'
}
and you should synch your project adding this two libraries:
implementation 'com.google.android.exoplayer:exoplayer:r2.4.2'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.4'
So now I'm glad to here from you that the mirroring problem has been resolved and are you able to sync right now, without doing any changes to your build.gradle files.
I've left and updated my answer to better explain this situation.
Also some other famous repo take precautions: [-:
I am developing an application and I am getting the following error:
error: cannot access zzbgl
class file for com.google.android.gms.internal.zzbgl not found
I know there's a question here in StackOverflow with the same error that I'm getting posted 4 days ago but the answer did not help in my case. (I am talking about this one)
The error appeared just right after setting Firebase Analytics in my project.
My build.gradle (Module: app) file is this:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId 'com.geoactio.montferri'
minSdkVersion 14
targetSdkVersion 26
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:26.1.0'
// compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
implementation 'com.google.android.gms:play-services:12.0.1'
//implementation 'com.google.android.gms:play-services-maps:15.0.1'
//implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation 'com.navercorp.pulltorefresh:library:3.2.3#aar'
}
productFlavors {
}
lintOptions {
disable 'MissingTranslation'
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
My build.gradle (Project: myPorojectName) file is this:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
And clicking in the error leads me here, just after new MarkerOptions():
mapView.addMarker(new MarkerOptions().position(new LatLng(puntomarker.getLatitud(), puntomarker.getLongitud()))
.zIndex(0.5f)
.anchor(0.5f, 0.5f)
.title(puntomarker.getId() + "")
.snippet(puntomarker.getNombre())
.icon(BitmapDescriptorFactory.fromBitmap(((BitmapDrawable) marker).getBitmap())));
(being mapView a GoogleMap instance).
I hope someone can see the error and solve this, thank you so much in advance.
If you need any more information in order to solve this, please let me know.
The Google API Release Notes indicate that support for the combined play-services library ended in April 2018:
Starting with 15.0.0, there will no longer be a play-services alias target to pull in all Google Play services components. This has been recommended against for some time.
You can no longer specify a single dependency on the combined Google Play services target like this anymore:
implementation 'com.google.android.gms:play-services:12.0.1'.
When this was supported with previous versions, it pulled in ALL the Google Play libs way more than you need. See the list of APIs in Table 1 of the Setup Guide and include only the specific ones your app uses.
A check of the Google Maven Repository confirms that version 12.0.1 was the last version of the combined play-services target.
So please delete the above implementation and use only:
implementation "com.google.android.gms:play-services-base:15.0.1"
If you are also using other play services, please add them as separate dependencies.
I think your main reason for the error is that you are using 2 different versions for play services libraries
implementation 'com.google.android.gms:play-services:12.0.1'
Here it is 12.0.1
implementation "com.google.android.gms:play-services-base:15.0.1"
While here it is 15.0.1.
Try to use same version of related libraries everywhere.
Just simply you need to change a Dependency because 12.0.1 is no more
implementation 'com.google.android.gms:play-services:12.0.1'
To
implementation 'com.google.android.gms:play-services-base:15.0.1'
And press sync Gradle
Hope this may help you
updates the version of all dependencies.
Generally, this error will happen if you are working with several new and old dependencies.
I want to use google cloud messaging for push notification to android application. I read bellow document and set firebase to my application. My gradle build successfully but in implementation 'com.google.firebase:firebase-core:16.0.1' part, I get following error:
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.0, 16.2.0, 16.1.1, 16.0.1, 16.0.0, 15.0.1. Examples include com.google.firebase:firebase-messaging:17.1.0 and com.google.firebase:firebase-iid:16.2.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
App gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "notificationtest.com.test.notification"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
}
apply plugin: 'com.google.gms.google-services'
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
What is the problem and how can I solve it?
You have added 2 different versions of firebase library.
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
Please change it to same version i.e, 15.0.2
I am using this version only and did not face a problem until now. If you want you can probably use 16.0.1 for messaging also. There might be a possibility that google has not released version 17 for firebase-core.
My project was working fine until one day, because of no reason (I didn't change anything), gradle started giving this strange error:
Program type already present: com.google.android.gms.internal.measurement.zzabo
At the time of this error my project level gradle was like this:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
maven { url 'https://plugins.gradle.org/m2/'}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
classpath 'io.fabric.tools:gradle:1.25.3'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/sayyam/maven'
}
maven {
url "https://jitpack.io"
}
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this was my app level gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
defaultConfig {
applicationId "com.example"
deviceCheck
minSdkVersion 17
targetSdkVersion 27
versionCode 8
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
implementation 'com.google.android.gms:play-services-maps: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'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
.....other dependencies.....
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I searched and found this answer on stackoverflow. Which says that this issue might be related to firebase dependency version and google-services plugin. So i updated google-services plugin version to 4.0.0 and firebase to its latest version 16.0.0. And as one could expect from gradle, it gave another error which seems to be related to firebase version 16.0.0.
Whenever i change firebase version to 16.0.0, apparently it tries to automatically upgrade google play services dependencies to 16.0.0 too. Which doesn't EVEN exist! It raises following gradle error:
Failed to resolve: com.google.android.gms:play-services-maps:16.0.0
Failed to resolve: com.google.android.gms:play-services-location:16.0.0
Failed to resolve: com.google.android.gms:play-services-places:16.0.0
Failed to resolve: com.google.android.gms:play-services-gcm:16.0.0
Failed to resolve: com.google.android.gms:play-services-base:16.0.0
Failed to resolve: com.google.android.gms:play-services-basement:16.0.0
Failed to resolve: com.google.android.gms:play-services-measurement-base:16.0.0
Failed to resolve: com.google.android.gms:play-services-tasks:16.0.0
Failed to resolve: com.google.android.gms:play-services-stats:16.0.0
Failed to resolve: com.google.android.gms:play-services-ads-identifier:16.0.0
I have tried to force version of gms libraries using resolutionStrategy but to no avail. What should i do? What am I doing wrong?
NOTE: I didn't change play services libraries version explicitly, gradle seems to do it because of firebase.
EDIT: This problem can be solved by the solution given in this question, but still its not duplicate because in my case onesignal plugin was updating only gms libraries version and not firebase version. So anybody facing this problem won't search for keywords used in this question.
I believe you have run into the same issues as the poster of https://stackoverflow.com/a/50516114/7070704 with the same resolution.
Basically, the com.onesignal.androidsdk.onesignal-gradle-plugin plugin is forcing an uplift on your dependencies onto something which does not exist.
In my app, I am trying to use gcm services, but I cannot even get gradle to compile. I keep getting the message that I am missing 'firebase core' though I have no idea how to install this.
This is my top-level gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath "io.realm:realm-gradle-plugin:1.1.0"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://mint.splunk.com/gradle/"
}
}
}
And here is my module-level gradle file:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "roof.android"
minSdkVersion 17
targetSdkVersion 23
versionCode 11
versionName "0.0.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTIC E.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties'
exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// "The Android Support Library package contains several libraries that can be included in your application" -- https://developer.android.com/topic/libraries/support-library/features.html
compile 'com.android.support:appcompat-v7:24.0.0'
// "Native android recycler view library" -- https://developer.android.com/topic/libraries/support-library/features.html
compile 'com.android.support:recyclerview-v7:24.0.0'
// "A powerful image downloading and caching library for Android" -- http://square.github.io/picasso/
compile 'com.squareup.picasso:picasso:2.5.2'
// "Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster" -- https://developer.android.com/training/volley/index.html
compile 'com.android.volley:volley:1.0.0'
// "JsonWebTokens in Auth0" -- https://auth0.com/docs/jwt
compile 'com.auth0:java-jwt:2.1.0'
// "Joda-Time provides a quality replacement for the Java date and time classes" -- http://www.joda.org/joda-time/
compile 'joda-time:joda-time:2.8.1'
// "Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel" -- https://github.com/Cloudist/ACProgressLite
compile 'cc.cloudist.acplibrary:library:1.2.1'
// "A RecyclerView that is powered by Realm and lots more" -- https://github.com/thorbenprimke/realm-recyclerview
compile 'com.github.thorbenprimke:realm-recyclerview:0.9.22'
// "A beautiful ripple animation for your app" -- https://github.com/skyfishjy/android-ripple-background
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
// "A logger with a small, extensible API which provides utility on top of Android's normal Log class." -- http://jakewharton.github.io/timber/
compile 'com.jakewharton.timber:timber:4.1.2'
// "Field and method binding for Android views" -- http://jakewharton.github.io/butterknife/
compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
// "An HTTP+HTTP/2 client for Android and Java applications." -- http://square.github.io/okhttp/
compile 'com.squareup.okhttp3:okhttp:3.3.1'
// "Android client for Sentry"
compile 'com.joshdholtz.sentry:sentry-android:1.4.1'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
}
In your module Gradle file (usually the app/build.gradle), add the apply plugin(apply plugin: 'com.google.gms.google-services') line at the bottom of the file to enable the Gradle plugin.
You should also add the dependencies for the Firebase com.google.firebase:firebase-core and com.google.firebase:firebase-messaging SDK's:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Make sure you have the latest version of 'Google Play services' and 'Google Repository' installed while using Firebase.
Please follow below steps to install:
Open Android studio
Go to the Menu bar > Tools > Android > SDK Manager
Click on Tab > SDK Tools
Check and install 'Google Play Services' and 'Google Repository'
Click on Apply and wait for the download
Finally, Sync and build your project again.
You want to add push notifications in your app ?
use firebase instead of GCM. it is enhanced version of GCM.
You need following dependencies for firebase push notifications.
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.google.android.gms:play-services-gcm:9.0.1'
for further info visit http://codingaffairs.blogspot.com/2016/06/firebase-cloud-messaging-push.html
I had the same problem with com.google.firebase:firebase-core:11.8.0 and it worked after moving the google() repository above jcenter().
In between I used Build -> Clean Project.
./build.gradle
buildscript {
repositories {
google() // <- now on top!
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google() // <- now on top!
jcenter()
}
}
If you want to add the firebase core, you can add
compile 'com.google.firebase:firebase-core:9.0.0'
under dependencies tag in your module-level gradle file.
If you still can't resolve it, maybe you need to update the SDK to get the Google Play Services rev 30 and Google Repository rev 26 first. See here for the detail.
In your android/build.gradle in your repositories section, try moving google() ABOVE jcenter().