implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-invites:16.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.0'
Above are the dependencies which I have added according to my requirement.
Following is the google play service dependency which I am using.
- implementation 'com.google.android.gms:play-services:12.0.1'
I have also added the 'apply plugin' statement at the end
- apply plugin: 'com.google.gms.google-services'
Please help me out to solve the error!
Are you importing google services in your build.gradle(root level)?
build.gradle root level
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
build.gradle app level
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
implementation 'com.google.android.gms:play-services:12.0.1'
// ...
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-invites:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Related
This question already has answers here:
Gradle sync failed: Plugin with id 'com.google.android.gms:play-services' not found
(3 answers)
Closed 3 years ago.
I'm trying to add Firebase to my Android app, while syncing the project I got:
Gradle sync failed: Plugin with id 'com.google.gms:google-services' not found.
I added the dependencies, google-services.json file in app root, also I added Maven repo in build.gradle top level.
1/ build.gradle top project file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
jcenter()
google()
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0' // Google Services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
archRoomVersion = "1.0.0-alpha1"
}
}
2/ build.gradle // app level
dependencies {
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:compiler:1.1.1"
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable: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 "android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"
implementation 'com.google.firebase:firebase-core:16.0.1'
}
buildscript {
ext {
navigationVersion = '1.0.0-alpha09'
}
}
apply plugin: 'com.google.gms:google-services' // Google Play services Gradle plugin
Any idea what should I do?
The apply plugin is wrong. Should be:
apply plugin: 'com.google.gms.google-services'
Notice the . between com.google.gms and google-services.
Also, just in case, google() should go before jcenter().
I have created a firebase project and it says I have to modify the core version to 12 according to the picture
The default code is 9.6.1. So, I changed that number to 12.0.1
compile 'com.google.firebase:firebase-core:12.0.1'
However, the sync failed with the following error
Failed to resolve: com.google.firebase:firebase-core:12.0.1
What should I do?
Update the gms plugin:
classpath 'com.google.gms:google-services:4.0.0' // google-services plugin
and the firebase lib:
implementation 'com.google.firebase:firebase-core:16.0.0'
Also add google maven to your build.gradle file:
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter()
maven { url "https://jitpack.io" }
}
}
com.google.firebase:firebase-core:12.0.1 is old version already.
You can try version 15.0.0 or as Levi Albuquerque said 16.0.0
However just to remind you that if you implement more than one same kind of library, they should be always in the same version to avoid any syncing error.
Example
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
All are same version 15.0.0
You need to add the google() maven inside your allProjects block in your 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()
}
}
For avoid further errors in grandle beacause of a bug try to use:
classpath 'com.google.gms:google-services:3.2.1'
And for firebase use what you need from below:
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-analytics:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-firestore:16.0.0'
implementation 'com.google.firebase:firebase-functions:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation 'com.google.firebase:firebase-perf:15.2.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.google.firebase:firebase-config:15.0.2'
If you using gogle play-services in your grandle set version to 15.0.0 like below example:
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.google.android.gms:play-services-gcm:15.0.0'
I hope this will help you =)
Im trying to add firebase to a project that i already started, But in the build.gradle (app) i am having a dependency collision between play-services-maps and firebase, i looked everywhere and tried changing the version number but still not working.
here is the build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.android.tencho.test"
minSdkVersion 22
targetSdkVersion 26
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'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services:15.0.1'
// implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.android.support.constraint:constraint-layout: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.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.google.firebase:firebase-core:16.0.0'
// //Firebase Auth
implementation 'com.google.firebase:firebase-auth:16.0.1'
// //FirebaseUI Auth
compile 'com.firebaseui:firebase-ui-auth:3.3.0'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle (project level)
// 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'
// The google-services plugin has 2 main functions:
// 1) Process the google-services.json file and produce Android resources that can be used in your
// application's code
// 2) Add dependencies for basic libraries required for the services you have enabled. This step requires
// that the apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
// so that no dependency collisions are introduced.
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You are using inconsistent version.
Let me tell you simple example.
If you are using google play services 11.8.0, then firebase should also be in same version..
compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
So the main thing to be noted is, you are using inconsistent versions.
I have android app in kotlin which is giving me this error.
Error: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.google.firebase.auth.FirebaseAuth, unresolved supertypes: com.google.android.gms.internal.aad
and this
Error:Execution failed for task ':app:compileDebugKotlin'.
Compilation error. See log for more details
this is my app module
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "appname"
minSdkVersion 15
targetSdkVersion 26
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'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:animated-vector-drawable:26.1.0'
implementation 'com.android.support:mediarouter-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
//noinspection GradleCompatible,GradleCompatible
implementation 'com.google.android.gms:play-services:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
and my project gradle is this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have firebase.auth implementation but still, it's showing me the error.
Updating com.firebaseui:firebase-ui-auth to 3.3.1 fixed it for me. As the older versions (3.1.0 in my case) was not compatible with com.google.firebase:firebase-messaging v15
Updating all the dependencies from the "com.google.android.gms:" group and also the firebase-messaging version to 15.0.0. instead of 12.0.1 fixed this issue for me.
i see at least 2 problems in your gradle file:
You have a duplicated entry for "kotlin-stdlib-jre7" (one implementation and one compile). Remove the last one:
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
Not using the latest versions of firebase & google play services: update to firebase 11.6.2
The other thing that may happen is that you are using implementation instead of api for one of your dependencies which may conflict with another dependency in your module.
Add following in gradle:-
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
If you are using firebase-bom, then you should update to latest version. For me, after upgading to latest it started working.
Lastest version as of now :
com.google.firebase:firebase-bom:24.5.0
You can check latest version HERE
add this solves my problem
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
I am not able to use GoogleSignIn(com.google.android.gms.auth.api.signin.GoogleSignIn
) and GoogleSignInClient(com.google.android.gms.auth.api.signin.GoogleSignInClient
) while implementing Google Sign In in Android Studio while I can access other classes in App like
com.google.android.gms.auth.api.signin.GoogleSignInAccount;
com.google.android.gms.auth.api.signin.GoogleSignInOptions;
com.google.android.gms.common.SignInButton;
A strip down version of my build.gradle(app) file is as follow
android {
}
dependencies {
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-gmail:v1-rev72-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.google.gms:google-services:3.1.2'
}
apply plugin: 'com.google.gms.google-services'
and my build.gradle(package) is
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.2'
}
}
Any help would be appreciated
add this to your app-level dependency
compile 'com.google.android.gms:play-services-auth:12.0.1'
I was having the same issue
GoogleSignIn and GoogleSignInClient were introduced in version Google Play services SDK version 11.6. In older versions GoogleApiClient was used.
So try changing the compile 'com.google.android.gms:play-services-auth:11.4.2' to 'com.google.android.gms:play-services-auth:12.0.1' in dependencies
dependencies
{
compile 'com.google.android.gms:play-services-auth:12.0.1'
}
For me I was applying a plugin for the google play services in my app's build.gradle:
apply plugin: 'com.google.gms.google-services'
along with that in my Project's Build.gradle I had google services.
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:3.1.2' // <== this guy
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
I remember I added them with some compiling issues. But apparently I didn't need them.
By removing them I found there were no more issues with the gms versions.
EDIT
So removing solved my issue initially, but gave me issues later with google sign in. adding the apply plugin: 'com.google.gms.google-services' to the bottom of my projects gradle instead of at the top did actually solve it.
In the build.gradle Module script, I had to add these two dependencies, then "Sync Now" and issue resolved for me.
dependencies {
// Your own command lines
//...
compile 'com.google.android.gms:play-services-drive:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
}
Can't you use any newer version? e.g. 11.6.0.
Try to update your Google Repository as well.
(Tools->Android->SDK Manager->SDK Tools under Support Repository)
Add this line in build.gradle module file under dependencies.
implementation 'com.google.firebase:firebase-auth:21.0.1'
For example:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-database:20.0.2'
implementation 'com.google.android.gms:play-services-auth:20.2.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'de.hdodenhof:circleimageview:3.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}