arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1k stars 1.55k forks source link

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

Open newuser44 opened 5 years ago

newuser44 commented 5 years ago

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 commented 5 years ago

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.

josuper commented 5 years ago

someone solved it ?

JuanAlejandro commented 5 years ago

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'
newuser44 commented 5 years ago

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?)

phiasco12 commented 4 years ago

Why doesn't this fix it for me?

phiasco12 commented 4 years ago

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

alopezjs commented 4 years ago

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

hamza3747 commented 3 years ago

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' }