Building Android fails with unknown build exception


#1

i have this error when i build android…
I’have already try to remove and add the android platform, but nothing is changed.
Any Idea?
Thank you so much.

My system information:

Cordova CLI: 6.4.0 
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: macOS Sierra
Node Version: v4.4.2
Xcode version: Xcode 8.3.3 Build version 8E3004b

THE ERROR -->

To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

Dex: Error converting bytecode to dex:

Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
    	at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
    	at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
    	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
    	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
    	at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    	at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
    	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
    	at com.android.dx.command.dexer.Main.run(Main.java:277)
    	at com.android.dx.command.dexer.Main.main(Main.java:245)
    	at com.android.dx.command.Main.main(Main.java:106)
    

:transformClassesWithDexForDebug FAILED


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

* 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: 47.152 secs

Error: /Users/Ideattiva/Documents/bitBucket/vivibike/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
    	at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
    	at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
    	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
    	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
    	at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    	at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
    	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
    	at com.android.dx.command.dexer.Main.run(Main.java:277)
    	at com.android.dx.command.dexer.Main.main(Main.java:245)
    	at com.android.dx.command.Main.main(Main.java:106)
    

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

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

there my package.json

{
  "name": "vivibike",
  "version": "1.0.0",
  "description": "vivibike: An Ionic project",
  "dependencies": {
    "@ionic/cloud": "^0.9.0",
    "async": "^1.4.0",
    "bluebird": "^3.4.6",
    "gulp": "^3.5.6",
    "gulp-angular-templatecache": "^1.5.0",
    "gulp-concat": "^2.2.0",
    "gulp-install": "^0.6.0",
    "gulp-sass": "^2.0.4",
    "gulp-sourcemaps": "^1.5.2",
    "require-dir": "^0.3.0"
  },
  "devDependencies": {
    "bower": "^1.3.3",
    "gulp-util": "^2.2.14",
    "shelljs": "^0.3.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",
    "gulp-zip": "^3.0.2",
    "jshint": "^2.8.0",
    "minimist": "^1.1.2",
    "mv": "^2.1.1"
  },
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen@3.0.0",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard",
    "cordova-plugin-image-picker",
    "cordova-plugin-x-socialsharing",
    "cordova-plugin-inappbrowser",
    "cordova-plugin-geolocation",
    "cordova-plugin-transport-security",
    {
      "variables": {
        "SENDER_ID": "vivibike-f2815"
      },
      "locator": "phonegap-plugin-push",
      "id": "phonegap-plugin-push"
    }
  ],
  "cordovaPlatforms": [
    "ios@4.2.1",
    "android@5.2.2",
    "ios"
  ]
}

#2

Two plugins define and use the same stuff. Googling and searching the forum for parts of the error message should help you find a solution to this.