Error build Android error code 1 and DexforDebug


I am doing a cordova app. The iOS is running well. But today, I tried it for Android. When I run the command : cordova build android I have the build failed …

:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> java.util.concurrent.ExecutionException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.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.


Total time: 37.222 secs
Error: Error code 1 for command: /Users/guillaume/Desktop/fcm/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/guillaume/Desktop/fcm/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true 

Before that, there is also that comment :

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
For more information see
Dex: Error converting bytecode to dex:
Cause: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

So I tried to add org.gradle.jvmargs=-Xmx2048M in the, but I think this file is only in platform folder, so if I change it, it will stay the same when I will run “cordova build android” again…

Do you know what to do ?

try removing Android platform and re adding it has solved my problem

$ cordova plaform remove android
$cordova platfform add android