Error build Android error code 1 and DexforDebug

Hello,

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'.
> 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_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.

BUILD FAILED

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 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 Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

So I tried to add org.gradle.jvmargs=-Xmx2048M in the gradle.properties, 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