0
votes

I got this error

`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.dex.DexException: Multiple dex files define Lcom/google/zxing/BarcodeFormat; `

I have enabled Multidex (multiDexEnabled = true) in build.gradle and also added following

dexOptions {
      incremental = true;
      preDexLibraries = false
      javaMaxHeapSize "2g"
    }

but still getting that error.

1

1 Answers

0
votes

Even I was facing the similar issue, I tried updating Cordova, Ionic and setting ANDROID_HOME and JAVA_HOME and almost all the solution over the web, but nothing worked for me. Finally, it was the issue with PhoneGap-push plugin. The 2.0 version of PhoneGap-push plugin has some collision with some plugins like

Google Analytics

To be more specific the plugins that use google play services.

So Below is my solution.

  1. First, remove the PhoneGap-push plugin 2.0 from your application.
  2. Now try to build the app by commenting all the lines that use push plugin.
  3. If the build is successful then it will be the issue with push plugin. Then follow below instructions to fix the issue. If the build is not successful then you might be having some other issue.
  4. First, uninstall the PhoneGap-push plugin 2.0
  5. Then go to project -> package.json and search for push and replace the line with “”: “4.0.1” earlier it will be 4.3.0 or 4.3.1
  6. Now add push plugin again to the project with below command ionic plugin add [email protected] --variable SENDER_ID=XXXXXXX
  7. Now build your app works like a charm....

This issue is already opened in phonegap-pushplugin repo . They have a next milestone of releasing version 2.1.0 which will be fixing this issue.