How to fix "Could not find com.google.gms:google-services3.0.o " Even after adding json file andgoogle-services.json file applying plugin for it
This is where i applied plugin for google services
[Classpath dependencies][3]
add this in your project module gradle
classpath 'com.google.gms:google-services:3.0.0'
add dependencies
compile 'com.google.android.gms:play-services-auth:10.2.0'
}
apply plugin: 'com.google.gms.google-services'
Related
I updated my Android project to 7.0.2 and this changed the
classpath 'com.google.gms:google-services:4.3.8' to
classpath 'com.google.gms:google-services:4.3.9'.
After the update I started getting an error that FirebaseApp is not initialized or build Gradle does not include gms: google services.
I tried to add
FirebaseApp.initializeApp(mycontext);
method also in my Firebase token Async Task where the error is triggering, but this does not help.
Can someone suggest how to fix it?
In your app-level Gradle file add the 'apply plugin' line at the bottom of the file to enable the Gradle plugin:
apply plugin: 'com.android.application'
dependencies {
// ...
implementation 'com.google.firebase:firebase-bom'
// If getting a "Could not find" error? Make sure you have the latest Google
// Repository in the Android SDK manager
}
//ADD THIS LINE AT BOTTOM
apply plugin: 'com.google.gms.google-services'
or you can add plugin like this:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
Now, sync both the gradle files
I have followed the Firebase tutorial and I have also checked several times if I have made any mistakes but I can't find it.
The problem is that when I try to add the library to classpath nothing happens. You see in this picture I get the pop-up screen but it remains red after my click and not imports?
You Must Add these dependencies into your build.gradle (Module) file:
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
Also add google-services classpath to build.gradle (Top-level):
classpath 'com.google.gms:google-services:4.1.0'
And It is important to successfully run the application add google-services.json in
app module folder with enable plugin at build.gradle (Module) file:
apply plugin: 'com.google.gms.google-services'
After update Android Studio to 2.3 version I have warning:
Warning:Using incompatible plugins for the annotation processing:
android-apt. This may result in an unexpected behavior.
Any solutions? My app stopped working...
Your app level gradle dependencies should include (as per butterknife website instructions):
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
You can remove the line :
apply plugin: 'com.neenbedankt.android-apt'
Annotation Processing became available in Android Gradle plugin (2.2 and later) so there is now no need to use the above plugin anymore if using this version of gradle or greater.
If you'd like to know how to turn annotation processing off and on and AS the setting is in :
Settings > Build, Execution, Deployment > Compiler > Annotation Processors
In my project I use, among other things, Butter Knife and Immutables. After adding Immutables I got the following warning
Warning:Using incompatible plugins for the annotation processing:
android-apt. This may result in an unexpected behavior.
and ButterKnife stopped working.
My configuration was as follows:
build.gradle (Project: MyApplication)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
build.gradle (Module: app)
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
...
dependencies {
...
// Butter Knife
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
// Immutables
apt 'org.immutables:value:2.4.4'
provided 'org.immutables:value:2.4.4'
provided 'org.immutables:builder:2.4.4'
provided 'org.immutables:gson:2.4.4'
}
After changing
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
to
apt 'com.jakewharton:butterknife-compiler:8.5.1'
warning disappeared and everything works as it should.
UPDATE
As Mark said, an annotation processor was included in the Gradle version 2.2 , so there is no reason to provide an extra one.
So:
1) Remove the class path for the apt from the build.gradle (Project: MyApplication)
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
2) Remove the plug in from the build.gradle (Module: app)
apply plugin: 'android-apt'
3) Change the dependencies from apt to the new annotationProcessor
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
annotationProcessor 'org.immutables:value:2.4.4'
To add to #Milan's answer, if you used the hotchemi permissiondispatcher library in your app level gradle file then you should replace it as follows:
Replace
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
with
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
At Project Gradle buildscript --> dependencies block, remove the second classpath line :
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
And at app Gradle dependencies block, change these lines, use api and annotationProcessor :
api 'com.google.dagger:dagger:2.19'
annotationProcessor 'com.google.dagger:dagger-compiler:2.19'
Also, remove this one:
//apply plugin: 'com.neenbedankt.android-apt'
i'm trying to add Google Firebase Notifications on my Phonegap Cordova app, built with Ionic. I've already installed successfully a Google Plus plugin for login (i think this would be a useful info).
I only need this Firebase plugin to complete my job but i've been stopped by this error when i build my app for Android.
A problem occurred configuring root project 'android'.
Cannot add task ':processDebugGoogleServices' as a task with that name already exists.
I follow this tutorial for setup Cordova Plugin Firebase Cloud Messaging For Android
Here is my build.gradle file edited as the tutorial said:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
--------
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.google.android.gms:play-services-plus:9.2.0"
compile "com.google.android.gms:play-services-identity:9.2.0"
compile "com.android.support:support-v4:+"
compile "com.android.support:appcompat-v7:+"
compile "com.android.support:appcompat-v7:23.2.1"
compile "com.google.firebase:firebase-messaging:9.0.2"
// SUB-PROJECT DEPENDENCIES END
}
apply plugin: 'com.google.gms.google-services'
Had the same issue. It appears com.android.application already includes google-services.
To fix it remove:
apply plugin: 'com.google.gms.google-services'
use classpath 'com.android.tools.build:gradle:2.2.2' instead of classpath 'com.android.tools.build:gradle:2.2.0'
and use dependency
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
make sure that you add the google_service json file in your app folder
I've find out a solution.
remove platform android from project
add again platform android (which reload all dependencies and plugin)
repeat all steps on that guide (setup Firebase notifications)
Everything works well! The problem was on a conflict between Google Plus plugin and Firebase which requires both same services.
fcmplugin.gradle and build.gradle need google-services
so, change this:
apply plugin : 'com.google.gms.google-services'
to this:
ext.postBuilderExtras = {
apply plugin : com.google.gms.googleservices.GoogleServicesPlugin
}
Can't use google maps because of above said error. Anyone find the same issue ?
Make sure that the following line is at the end of the app build.gradle file:
apply plugin: 'com.google.gms.google-services'
Mine was on the top and gradle was defaulting to 8.3.0 instead of what was specified: 8.4.0
My build.gradle files are the same as the ones in the Version conflict updating to 8.4.0
As those previous anweres are only part-wise complete.
Here are my three steps which worked fine for me:
Put this to the end of your apps build.gradle
apply plugin: 'com.google.gms.google-services'
Set your projects build.gradle dependencies to
'classpath 'com.google.gms:google-services:2.0.0-alpha5'
Set Gradle Version to 2.10
Android Studio: File > Project Structure > Project
#redsonic's answer worked for me.. By simply moving apply plugin:
'com.google.gms.google-services' after the dependecies in
build.gradle (Module: app)
I'm using Android Studio 1.5.1 with Gradle version 2.10
In case you are using Gradle version older than 2.10 you'll also need to update that by selecting the ProjectName or app directory in the Project tool Windows and pressing F4. This will open Project Structure window, select Project from the menu and update Gradle version to 2.10. Press OK (Android Studio will download it in background).
build.gradle (Project: ProjectName)
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
build.gradle (Module: app)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.4.0'
}
apply plugin: 'com.google.gms.google-services'
This is a slight variant of #Lord Flash's answer:
For me it wasn't necessarily that I should place the google services plugin at the bottom of the file it was that it should come before the com.android.application plugin.
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
Also there are newer binaries than the alpha variants for google-services
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:2.0.0-beta6'
}
}
I'm sure there will be newer ones soon. I found the list of variants here
follow all the steps at this link Add App Invites to Your App
use this : compile 'com.google.android.gms:play-services-appinvite:8.4.0'
instead of this : compile 'com.google.android.gms:play-services:8.4.0'
please follow all the steps and then build the project
hope thats help
I had the same problem, and I found that moving:
apply plugin: 'com.google.gms.google-services'
To the bottom of the module app gradle.
and then use:
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.0'
The problem is that some of your app dependencies that start with com.google.android.gms: have a version that is incompatible your project dependencie classpath 'com.google.gms:google-services:
Check for these on your app build.gradle
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
And for this in your project build.gradle
classpath 'com.google.gms:google-services:1.5.0'
You can update your project build.gradle to use the latest google-services version or your can just change your app dependencies to use the 8.3 version.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// this should solve the gradle update error if it persists even after following above steps
Make sure that the following line is at the end of the app build.gradle file:
compile 'com.google.android.gms:play-services:11.0.2'
google update there API day by day.Now mine is '11.0.2'
try with the updated API