Ionic Android Build failed with Multiple dex files define Lcom/google/android/gms/common/api/zza



I am working on a professionel project with Ionic 2. I have the presentation with clients coming monday (24/04/2017). Unfortunately from last Friday i am facing a conflict with cordova plugins. The application works well with IOS but build fails with Android. I think the conflict comes with :
–> cordova-plugin-mauron85-background-geolocation “CDVBackgroundGeolocation”
–> cordova-plugin-fcm “FCMPlugin”

At the beggining i had a version conflict, so i changed the version into cordova-plugin-mauron85-background-geolocation with framework src=“” . The error was :

Found, but version 9.0.0 is needed for the google-services plugin.
:processDebugGoogleServices FAILED

After solved the version conflict, now i am facing a new problem. The problem is:


FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:transformClassesWithDexForDebug’. java.util.concurrent.ExecutionException: Multiple dex files define Lcom/google/android/gms/common/api/zza;

And as i have always in my console the following message, i have tried to fix it manually. I tried to apply some solutions that i have found by searches.

The message in console is :

google-services plugin could not detect any version for or, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.

The manual fix was adding the following lines in my platforms/android/build.graddle (in correct places):

  • classpath ‘’ (in classpath dependencies)
  • apply plugin: ‘’ (at the bottom of the file)

But i got the following error with this modification, so i deleted them :

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.
    Error: cmd: Command failed with exit code 1 Error output:
    FAILURE: Build failed with an exception.

My platforms/android/ :


I join my ./gradlew assembleDebug --stacktrace in this link

Hope that i will get some help.


Did you get the solution? I am facing similar issue.


Sorry for the late answer,

After running “ionic run android --device” or “ionic build android”, you need to change all + by a specific version in platform/android/ expect . In my case, i replaced all + by 9.0.0 and it worked.