Plugin with id 'com.google.gms:google-services' not found [duplicate] - android

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().

Related

Can't build consent-library:1.0.7

I can't build my Project when I add I follow [https://developers.google.com/admob/android/eu-consent]
I got below error!
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.google.android.ads.consent:consent-library:1.0.7.
buildscript {
repositories {
jcenter()
google()
// maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
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.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
}
there only is a version 1.0.6, as the link you've provided states:
implementation "com.google.android.ads.consent:consent-library:1.0.6"
for it to work, you'd also need to add this plugin to the buildscript dependencies:
classpath "com.google.gms:google-services:4.2.0"
and apply that plugin at the bottom of the file:
apply plugin: "com.google.gms.google-services"
and a google-services.json file needs to be added to the project, which provides the ga_trackingId... see the documentation.

class file for com.google.android.gms.internal.zzbgl not found

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'

Butter Knife Build Gradle

Using Android Studio 3.1.1, I'm try to add Butter Knife to project but build gradle fail.
the module level:
{ ...
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'}
And below is the build project level:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
enter image description here
I recreated the new project from scratch and tested any solutions everybody said, but it does not work and still it does fail with this message:
Failed to resolve: support-compat
Eraser all your changes and just add:
dependencies {
.
.
.
.
.
.
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
Downgrad to
implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
and classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
your problem is you added extra implementation keyword in your dependencies, change your project dependencies with code below
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
Ad this in your project level gradle
repositories {
google()
jcenter()
maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT' // here
}
And apply plugin on app level gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'//here

How do I solve this Implementation() error?

I'm getting an error whenever I run the implementation() method.
I tried to import this Insiteo '.aar' file and set it's dependencies, but there's an issue with calling 'implementation()' method. Help?
Insiteo module build.gradle:
configurations.maybeCreate("default")
artifacts.add("default", file('Insiteo-SDK-3.6.3g.aar'))
dependencies {
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
}
Here's the error
Error:(6, 0) Could not find method implementation() for arguments ['com.squareup.retrofit:retrofit:2.0.0-beta2']
App module build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
apply plugin: 'com.android.library'
defaultConfig {
applicationId "com.example.joey.projectgenesis"
minSdkVersion 26
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
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'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
implementation project(':Insiteo')
}
Project build.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'
// 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
}
My Android plugin version is 3.0.1, and my Gradle version is 4.4.1
I've also tried compile() as well with the same error.
There isn't any problems with the other build.gradle scripts, just the Insiteo module script, and it's only with the implementation() method.
AFAIK, you can't add dependencies to an aar module like that. You most likely need to apply the app or library plugin in order to do that.
But it's generally easier just adding the dependencies directly into your project; not into the library module. Example:
Root /
app/
myAarLibrary/
Don't define dependencies in myAarLibrary, define them in app
Your gradle have some problem. You can use compile instead implelentaion in gradle dependencies. All gradle support this by default.
Make sure you are using Android Studio 3.0 or above.
Your app level build.gradle should look like this:
// 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'
// 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
}
Make sure your gradle-wrapper.properties looks like this:
#DATE
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Use
implementation 'com.squareup.retrofit:retrofit:2.3.0'
implementation 'com.squareup.retrofit:adapter-rxjava:2.3.0'
implementation 'com.squareup.retrofit:converter-gson:2.3.0'
instead of
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'

Supertypes of the following classes cannot be resolved

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"

Categories

Resources