Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

build failed - Cannot add extension with name 'googleServices', as there is an extension already registered with that name. (cordova-plugin-firebasex compatibility) #130

Open
Solomakha-Dmytro opened this issue Oct 31, 2019 · 3 comments
Labels

Comments

@Solomakha-Dmytro
Copy link

Im install cordova-plugin-appcenter-push@0.5.1, and already have cordova-plugin-firebasex@6.0.7 in my project. And have error when trying to build android apk.

ERROR:

  • Where:
    Script 'C:\software\rep\veo.mobile\projects*appname*\platforms\android\cordova-plugin-appcenter-push*appname*-AppCenterPush.gradle' line: 14
  • What went wrong:
    A problem occurred evaluating project ':app'.

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

Now im have the same code in /platforms/android/cordova-plugin-appcenter-push/appname-AppCenterPush.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

ext.postBuildExtras = {	
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

and /platforms/android/cordova-plugin-firebasex/appname-build.gradle:

buildscript {
    repositories {
        google()
        maven {
            url "https://maven.fabric.io/public"
        }
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "io.fabric.tools:gradle:1.30.0"
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}

cdvPluginPostBuildExtras.add({
    // Use class instead of id (string) to be able to apply plugin from non-root gradle file
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
    apply plugin: com.crashlytics.tools.gradle.CrashlyticsPlugin

    // Enable Crashlytics NDK reporting
    crashlytics {
        enableNdk true
    }
})

Repro Steps

Please list the steps used to reproduce your issue.

  1. Install cordova-plugin-firebasex@6.0.7
  2. install cordova-plugin-appcenter-push@0.5.1
  3. run cordova compile android

Details

  1. Which SDK version are you using?
    0.5.1

  2. What version of Cordova, Cordova platforms?
    Cordova version 9.0.0
    Installed platforms:
    android 8.0.0
    ios 5.0.1

  3. What third party plugins are you using?

  • com.verso.cordova.clipboard 0.1.0 "Clipboard"
  • cordova-android-support-gradle-release 3.0.0 "cordova-android-support-gradle-release"
  • cordova-base64-to-gallery 4.1.3 "base64ToGallery"
  • cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
  • cordova-plugin-android-permissions 1.0.0 "Permissions"
  • cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
  • cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
  • cordova-plugin-appcenter-push 0.5.1 "App Center Push for Cordova"
  • cordova-plugin-appcenter-shared 0.5.1 "App Center shared code for Cordova"
  • cordova-plugin-appsflyer-sdk 4.4.15 "AppsFlyer"
  • cordova-plugin-camera 4.0.3 "Camera"
  • cordova-plugin-contacts 3.0.1 "Contacts"
  • cordova-plugin-datepicker 0.9.3 "DatePicker"
  • cordova-plugin-decimal-keyboard-wkwebview 1.0.3 "Decimal Keyboard"
  • cordova-plugin-device 2.0.2 "Device"
  • cordova-plugin-file 6.0.1 "File"
  • cordova-plugin-file-opener2 2.2.1 "File Opener2"
  • cordova-plugin-file-transfer 1.7.1 "File Transfer"
  • cordova-plugin-firebase-lib 4.0.1 "Google Firebase Plugin"
  • cordova-plugin-firebasex 6.0.7 "Google Firebase Plugin"
  • cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
  • cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
  • cordova-plugin-ionic-webview 4.1.0 "cordova-plugin-ionic-webview"
  • cordova-plugin-ios-keychain 3.0.1 "KeyChain Plugin for Cordova iOS"
  • cordova-plugin-iroot 0.8.1 "iRoot"
  • cordova-plugin-listpicker 2.2.2 "ListPicker"
  • cordova-plugin-network-information 2.0.1 "Network Information"
  • cordova-plugin-splashscreen 5.0.2 "Splashscreen"
  • cordova-plugin-statusbar 2.4.3-dev "StatusBar"
  • cordova-plugin-whitelist 1.3.3 "Whitelist"
  • cordova-plugin-wkwebview-inputfocusfix 1.0.4 "WKWebView Input Focus Fix"
  • cordova-plugin-x-socialsharing 5.6.2 "SocialSharing"
  • es6-promise-plugin 4.2.2 "Promise"
@annakocheshkova
Copy link
Contributor

Hey! I'll consult with the team we'll see what we can do, but on the first look I can't say for sure if that's something that can be fixed, looks like a valid conflict.

@saikirangit
Copy link

But out of curiosity why would you need 2 plugins that supports same push feature ? Shouldn’t you use only one of them.?

@dannyf620
Copy link

you must remove all dependencies that use Google services from the package.json file, run npm install, then install each library again. in my case I had two "Firebase Analytics" and "Firebase crashlytics", with that there is congruence in the version of the packages.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants