cordova-plugin-firebase icon indicating copy to clipboard operation
cordova-plugin-firebase copied to clipboard

Plugin with id 'com.google.gms.google-services' not found.

Open newuser44 opened this issue 5 years ago • 8 comments

Describe the bug We already had plugin working with analytics. Was able to build fine.
I was trying to add android adaptive icons and things would not build. One suggestion was to reinstall the android platform.

After removing android platform (6.3) and adding it back I get a problem doing a build.

BUILD FAILED

Total time: 1.582 secs Error: /home/me/dev/Ionic-App/apps/new-app/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

  • Where: Script '/home/me/dev/Ionic-App/apps/new-app/platforms/android/cordova-plugin-firebase/newApp-build.gradle' line: 27

  • What went wrong: A problem occurred evaluating root project 'android'.

Plugin with id 'com.google.gms.google-services' not found.

I didn't change anything in the config.xml cordova might have. I still have <resource-file src="google-services.json" target="google-services.json" />

I can see the cordova-plugin-firebase folder with the new-app-build.gradle file This file looks correct

buildscript {

    repositories {

        jcenter()

        mavenCentral()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:+'

        classpath 'com.google.gms:google-services:4.1.0'

    }

}

repositories {

    mavenCentral()

    maven {

        url "https://maven.google.com"

    }

}



dependencies {

    compile 'me.leolin:ShortcutBadger:1.1.4@aar'

    compile 'com.google.firebase:firebase-auth:+'

    compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {

       transitive = true

    }

}

cdvPluginPostBuildExtras.add({

    apply plugin: 'com.google.gms.google-services'

    apply plugin: 'io.fabric'

})

I have tried to uninstall the plugin and add it back (never sure its uninstalled). That didn't seem to change anything.

To Reproduce Setup Ionic with Android 6.3 (or 6.4) Install Firebase Cordova Build code Should work

Expected behavior I expect to be able to build

Plugin Version cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"

newuser44 avatar Dec 20 '18 17:12 newuser44

I don't know why but these lines were missing in the build.gradle file.

// Fabric Cordova Plugin - Start Fabric Build Tools 
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath 'com.google.gms:google-services:+'
    }
}

apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

Once I added those back things are now building. Not sure why they were missing when removing and adding the platform back.

newuser44 avatar Dec 21 '18 15:12 newuser44

someone solved it ?

josuper avatar Feb 21 '19 22:02 josuper

yea @josuper . @newuser44 did it in the response above, adding the code below into the build.gradle file.

// Fabric Cordova Plugin - Start Fabric Build Tools 
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath 'com.google.gms:google-services:+'
    }
}

apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

JuanAlejandro avatar Mar 11 '19 16:03 JuanAlejandro

This does fix it but if you remove android and add it back you have to add this back in. Should it not already be included in the build.gradle when firebase is installed? (I assume that is all that needs those lines?)

newuser44 avatar Apr 01 '19 16:04 newuser44

Why doesn't this fix it for me?

phiasco12 avatar Sep 26 '19 12:09 phiasco12

can you please provide the full code for the build.gradle ?

phiasco12 avatar Sep 26 '19 12:09 phiasco12

adding this on android/build.gradle works for me: maven { url "$rootDir/../node_modules/react-native/android" } https://rnfirebase.io/docs/v5.x.x/installation/android#Update-Google-Play-service-maven-repository

alopezjs avatar Dec 20 '19 15:12 alopezjs

classpath 'com.google.gms:google-services:4.3.8'

Add this dependency in your Top level build gradle file and you are good to go.

Example:

dependencies { classpath "com.android.tools.build:gradle:4.2.1" classpath 'com.google.gms:google-services:4.3.8' }

hamza3747 avatar May 15 '21 03:05 hamza3747