1
votes

I am facing an error while running

ionic cordova build android --release

command. Below is the error

transformClassesWithDexForRelease

FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':transformClassesWithDexForRelease'.

    com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.uti l.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gm s/iid/zzc;

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

BUILD FAILED

1

1 Answers

1
votes

Change this file (..\platforms\android\build.gradle)

defaultConfig {


    versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
    applicationId privateHelpers.extractStringFromManifest("package")

    if (cdvMinSdkVersion != null) {
        minSdkVersion cdvMinSdkVersion
    }
}

to this

defaultConfig {

      minSdkVersion 21
   targetSdkVersion 26
    multiDexEnabled true

    versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
    applicationId privateHelpers.extractStringFromManifest("package")

    if (cdvMinSdkVersion != null) {
        minSdkVersion cdvMinSdkVersion
    }
}