Cannot add task ':processDebugGoogleServices' as a task with that name already exists

When I build it on my server, this issue doesn’t happens. Please help.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Cannot add task ':processDebugGoogleServices' as a task with that name already exists.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 19.801 secs
Error: /home/package/workspace/apps-f88e2d6d-80/cordova/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Cannot add task ':processDebugGoogleServices' as a task with that name already exists
2 Likes

Can you specify that please? Are you using ionic package here to get this error? How do you build “on your server”?

Also include your ionic info output and package.json and config.xml content.

Here you are

ionic info

global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1
Gulp CLI         : not installed globally
Ionic CLI        : 3.5.0
local packages:

@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-gulp    : 1.0.1
@ionic/cli-plugin-ionic1  : 2.0.0
Cordova Platforms         : android 6.2.3 ios 3.9.2
Ionic Framework           : ionic1 1.3.1
System:

Node       : v6.11.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10

Config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.iFi.app" version="1.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>iFi</name>
    <description>
        IFI logo here
    </description>
    <engine name="android" spec="~6.2.3"/>
    <author email="hi@ifi.io" href="http://ifi.io/">
	IFI
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="android-targetSdkVersion" value="23" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="Orientation" value="portrait" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <platform name="browser">
        <preference name="SplashScreen" value="/www/img/ifi-logo-icon-2208_1024.png" />
        <preference name="SplashScreenDelay" value="3000" />
        <preference name="SplashScreenBackgroundColor" value="green" />
        <preference name="ShowSplashScreen" value="false" />
        <preference name="SplashScreenWidth" value="600" />
        <preference name="SplashScreenHeight" value="300" />
    </platform>
    <platform name="android">
        <icon density="ldpi" src="resources\android\icon\drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources\android\icon\drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources\android\icon\drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources\android\icon\drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources\android\icon\drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources\android\icon\drawable-xxxhdpi-icon.png" />
        <splash density="port-ldpi" src="resources\android\splash\drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources\android\splash\drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources\android\splash\drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources\android\splash\drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources\android\splash\drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources\android\splash\drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <icon height="57" src="resources\ios\icon\icon.png" width="57" />
        <icon height="114" src="resources\ios\icon\icon@2x.png" width="114" />
        <icon height="40" src="resources\ios\icon\icon-40.png" width="40" />
        <icon height="80" src="resources\ios\icon\icon-40@2x.png" width="80" />
        <icon height="120" src="resources\ios\icon\icon-40@3x.png" width="120" />
        <icon height="50" src="resources\ios\icon\icon-50.png" width="50" />
        <icon height="100" src="resources\ios\icon\icon-50@2x.png" width="100" />
        <icon height="60" src="resources\ios\icon\icon-60.png" width="60" />
        <icon height="120" src="resources\ios\icon\icon-60@2x.png" width="120" />
        <icon height="180" src="resources\ios\icon\icon-60@3x.png" width="180" />
        <icon height="72" src="resources\ios\icon\icon-72.png" width="72" />
        <icon height="144" src="resources\ios\icon\icon-72@2x.png" width="144" />
        <icon height="76" src="resources\ios\icon\icon-76.png" width="76" />
        <icon height="152" src="resources\ios\icon\icon-76@2x.png" width="152" />
        <icon height="167" src="resources\ios\icon\icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources\ios\icon\icon-small.png" width="29" />
        <icon height="58" src="resources\ios\icon\icon-small@2x.png" width="58" />
        <icon height="87" src="resources\ios\icon\icon-small@3x.png" width="87" />
        <splash height="1136" src="resources\ios\splash\Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources\ios\splash\Default-667h.png" width="750" />
        <splash height="2208" src="resources\ios\splash\Default-736h.png" width="1242" />
        <splash height="2048" src="resources\ios\splash\Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="1024" src="resources\ios\splash\Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources\ios\splash\Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources\ios\splash\Default~iphone.png" width="320" />
    </platform>
    <platform name="wp8">
        <icon height="99" src="resources\wp8\icon\ApplicationIcon.png" width="99" />
        <icon height="159" src="resources\wp8\icon\Background.png" width="159" />
        <splash height="1280" src="resources\wp8\splash\SplashScreenImage.png" width="768" />
    </platform>
    <icon src="resources\android\icon\drawable-xhdpi-icon.png" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <allow-intent href="*.firebaseio.com" />
    <allow-intent href="auth.firebase.com" />
    <plugin name="com.ionic.keyboard" spec="https://github.com/driftyco/ionic-plugins-keyboard.git" />
    <plugin name="com.verso.cordova.clipboard" spec="https://github.com/VersoSolutions/CordovaClipboard.git" />
    <plugin name="cordova-plugin-actionsheet" spec="~2.3.3" />
    <plugin name="cordova-plugin-console" spec="^1.0.1" />
    <plugin name="cordova-plugin-device" spec="^1.0.1" />
    <plugin name="cordova-plugin-dialogs" spec="^1.1.1" />
    <plugin name="cordova-plugin-extension" spec="^1.1.4" />
    <plugin name="cordova-plugin-fcm" spec="~1.1.5" />
    <plugin name="cordova-plugin-geolocation" spec="^1.0.1" />
    <plugin name="cordova-plugin-globalization" spec="^1.0.1" />
    <plugin name="cordova-plugin-google-analytics" spec="~1.7.4" />
    <plugin name="cordova-plugin-googlemaps" spec="https://github.com/mapsplugin/cordova-plugin-googlemaps">
        <variable name="API_KEY_FOR_ANDROID" value="HIDE_THIS" />
        <variable name="API_KEY_FOR_IOS" value="HIDE_THIS" />
    </plugin>
    <plugin name="cordova-plugin-image-picker" spec="~1.1.1" />
    <plugin name="cordova-plugin-inappbrowser" spec="^1.0.1" />
    <plugin name="cordova-plugin-splashscreen" spec="^2.1.0" />
    <plugin name="cordova-plugin-whitelist" spec="^1.0.0" />
    <plugin name="de.appplant.cordova.plugin.email-composer" spec="https://github.com/katzer/cordova-plugin-email-composer.git" />
    <plugin name="ionic-plugin-deploy" spec="~0.6.5" />
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
</widget>

my package.json

{
  "name": "iFi",
  "version": "1.2.0",
  "description": "iFi.io",
  "dependencies": {
    "@ionic/cloud-angular": "^0.11.0",
    "angular": "^1.4.8",
    "angular-stripe": "^4.2.8",
    "async": "^1.4.2",
    "bower": "^1.7.7",
    "com.ionic.keyboard": "https://github.com/driftyco/ionic-plugins-keyboard.git",
    "com.verso.cordova.clipboard": "https://github.com/VersoSolutions/CordovaClipboard.git",
    "cordova-android": "^6.2.3",
    "cordova-plugin-actionsheet": "~2.3.3",
    "cordova-plugin-console": "^1.0.1",
    "cordova-plugin-device": "^1.0.1",
    "cordova-plugin-dialogs": "^1.1.1",
    "cordova-plugin-extension": "^1.1.4",
    "cordova-plugin-fcm": "~1.1.5",
    "cordova-plugin-geolocation": "^1.0.1",
    "cordova-plugin-globalization": "^1.0.1",
    "cordova-plugin-google-analytics": "~1.7.4",
    "cordova-plugin-googlemaps": "https://github.com/mapsplugin/cordova-plugin-googlemaps",
    "cordova-plugin-image-picker": "~1.1.1",
    "cordova-plugin-inappbrowser": "^1.0.1",
    "cordova-plugin-splashscreen": "^2.1.0",
    "cordova-plugin-whitelist": "^1.0.0",
    "cordova-uglify": "^0.2.8",
    "de.appplant.cordova.plugin.email-composer": "https://github.com/katzer/cordova-plugin-email-composer.git",
    "gulp": "^3.5.6",
    "gulp-angular-templatecache": "^1.8.0",
    "gulp-autoprefixer": "^3.1.1",
    "gulp-convert-encoding": "^1.0.0",
    "gulp-ignore": "^2.0.2",
    "gulp-notify": "^3.0.0",
    "gulp-sass": "^2.3.2",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-util": "^2.2.20",
    "ionic-plugin-deploy": "~0.6.5",
    "ionic-plugin-keyboard": "~2.2.1",
    "jshint": "^2.8.0",
    "protractor": "^4.0.9",
    "require-dir": "^0.3.0",
    "shelljs": "^0.3.0",
    "wd": "^0.4.0"
  },
  "devDependencies": {
    "@ionic/cli-plugin-cordova": "1.4.1",
    "@ionic/cli-plugin-gulp": "1.0.1",
    "@ionic/cli-plugin-ionic1": "2.0.0",
    "del": "^1.2.0",
    "gulp-flatten": "^0.1.1",
    "gulp-if": "^1.2.5",
    "gulp-json-editor": "^2.2.1",
    "gulp-minify-css": "^1.2.0",
    "gulp-ng-annotate": "^1.1.0",
    "gulp-ng-constant": "^0.3.0",
    "gulp-preprocess": "^1.2.0",
    "gulp-rename": "^1.2.2",
    "gulp-shell": "^0.4.2",
    "gulp-uglify": "^1.2.0",
    "gulp-useref": "^1.2.0",
    "jasmine-core": "^2.3.4",
    "jshint": "^2.8.0",
    "karma": "^0.13.22",
    "karma-chrome-launcher": "^2.2.0",
    "karma-jasmine": "^0.3.8",
    "karma-mocha": "^0.2.2",
    "karma-phantomjs-launcher": "^0.2.1",
    "karma-requirejs": "^0.2.6",
    "minimist": "^1.1.2",
    "mocha": "^2.4.5",
    "mv": "^2.1.1",
    "phantomjs": "^1.9.18",
    "protractor": "^4.0.9",
    "requirejs": "^2.2.0",
    "wd": "^0.4.0",
    "wd-bridge": "0.0.2"
  },
  "cordovaPlugins": [
    "com.ionic.keyboard",
    "https://github.com/katzer/cordova-plugin-email-composer.git",
    "cordova-plugin-extension",
    "cordova-plugin-console@^1.0.1",
    "cordova-plugin-device@^1.0.1",
    "cordova-plugin-dialogs@^1.1.1",
    "cordova-plugin-globalization@^1.0.1",
    "cordova-plugin-whitelist@1.0.0",
    "cordova-plugin-inappbrowser",
    "cordova-plugin-geolocation",
    "cordova-plugin-splashscreen",
    "cordova-plugin-whitelist",
    "cordova-plugin-extension@^1.1.4",
    "cordova-plugin-inappbrowser@^1.0.1",
    "cordova-plugin-whitelist@^1.0.0",
    "cordova-plugin-geolocation@^1.0.1",
    "cordova-plugin-splashscreen@^2.1.0",
    "cordova-plugin-console@1.0.1",
    "cordova-plugin-device@1.0.1",
    "cordova-plugin-geolocation@1.0.1",
    "cordova-plugin-extension@1.1.4",
    "cordova-plugin-splashscreen@2.1.0",
    "cordova-plugin-dialogs@1.1.1",
    "cordova-plugin-inappbrowser@1.0.1",
    "cordova-plugin-globalization@1.0.1",
    "cordova-plugin-camera",
    "uk.co.workingedge.phonegap.plugin.launchnavigator",
    {
      "locator": "https://github.com/VersoSolutions/CordovaClipboard.git",
      "id": "com.verso.cordova.clipboard"
    },
    {
      "variables": {
        "SENDER_ID": "HIDE_THIS"
      },
      "locator": "https://github.com/phonegap/phonegap-plugin-push.git",
      "id": "phonegap-plugin-push"
    },
    {
      "variables": {
        "API_KEY_FOR_ANDROID": "HIDE_THIS",
        "API_KEY_FOR_IOS": "HIDE_THIS"
      },
      "locator": "https://github.com/mapsplugin/cordova-plugin-googlemaps.git",
      "id": "cordova-plugin-googlemaps"
    },
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-actionsheet",
    "cordova-plugin-fcm",
    "cordova-plugin-google-analytics",
    "cordova-plugin-image-picker",
    "cordova-plugin-googlemaps",
    "phonegap-plugin-push",
    "cordova-plugin-hockeyapp@latest",
    "cordova-plugin-actionsheet@~2.3.3",
    "cordova-plugin-image-picker@~1.1.1",
    "ionic-plugin-keyboard@~2.2.1",
    "cordova-plugin-fcm@~1.1.5",
    "cordova-plugin-google-analytics@~1.7.4",
    "ionic-plugin-deploy"
  ],
  "cordovaPlatforms": [
    "android",
    "ios"
  ],
  "cordova": {
    "plugins": {
      "com.ionic.keyboard": {},
      "com.verso.cordova.clipboard": {},
      "cordova-plugin-actionsheet": {},
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-dialogs": {},
      "cordova-plugin-extension": {},
      "cordova-plugin-fcm": {},
      "cordova-plugin-geolocation": {},
      "cordova-plugin-globalization": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "HIDE_THIS",
        "API_KEY_FOR_IOS": "HIDE_THIS"
      },
      "cordova-plugin-image-picker": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-whitelist": {},
      "de.appplant.cordova.plugin.email-composer": {},
      "ionic-plugin-deploy": {},
      "ionic-plugin-keyboard": {}
    }
  }
}

My guess: 2 plugins are trying to do the same thing which doesn’t work. Did this suddenly appear after you added an additional plugin?

1 Like

Thanks,.It runs fine on my local. I didn’t add new plugin, it’s the first time i build android version with ionic package.

In package.json i imported cordova-plugin-google-analytics 2 times, however after remove it the same error message (Cannot add task ‘:processDebugGoogleServices’) still happens.

Can you please tell me which file I need to check for duplication ?

Thanks again.

I would also check config.xml.

But in general it can be different plugins doing the same thing, quite hard to debug.

I’m able to replicate it on my local. My local used ionic cli 2.0 and don’t have any problem but when I update it to ionic cli 3.6, the issue happens.

Here is the log

Found com.google.android.gms:play-services-analytics:+, but version 9.2.0 is needed for the google-services
plugin.
Found com.google.android.gms:play-services-maps:11.+, but version 9.2.0 is needed for the google-services
plugin.
Found com.google.android.gms:play-services-location:11.+, but version 9.2.0 is needed for the google-services
plugin.
:processDebugGoogleServices FAILED

BUILD FAILED

Total time: 1 mins 8.982 secs

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information
about the latest version is available at
https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of
com.google.android.gms to 9.2.0.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information
about the latest version is available at
https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of
com.google.android.gms to 9.2.0.

I deleted google-analytics and google-maps in config.xml and package.json but after build with
ionic cordova build android , it auto added. Do you know why ?

Hi, did you manage to solve this? I am having the same issue

1 Like

I’ve got the same problem here. :neutral_face: