0

When attempting to generate the signed APK for this Cordova project, I get the following error:

Error:Execution failed for task ':transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/cordova/AuthenticationToken.class

I have scoured and attempted the various solutions which have been posted around such as:

  1. Ensuring all Android build numbers are the same

  2. Added this:

java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex

  1. Added this:

Android Project Error Execution failed for task ':transformClassesWithJarMergingForDebug'

  1. Ensured all the references to play services are the same in build.gradle

I have tried this individually and also together but no matter what the same error is thrown.

Any suggestions are welcome, thanks

user812786
  • 4,302
  • 5
  • 38
  • 50
RLau
  • 11
  • 5
  • [This question](https://stackoverflow.com/q/44755497/777265) asks about an almost identical error - the cause is the same and so the answer will work for you. – DaveAlden Jul 05 '17 at 10:30
  • Thanks for your reply. Firstly i attempted to add this plugin which failed throwing "google-services.json was not found" to resolve this I updated android cordova to 6.2.2 and then was able to add the play-services-gradle-release. After this Android Studio recommended updating gradle which I did and I can see in the app build.gradle that it is now using the plugin. Unfortunately after doing all this the exact same error is being thrown as originally posted. Do you have any further ideas? – RLau Jul 05 '17 at 13:05
  • Sorry the error message is slightly different > Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/AuthenticationToken; – RLau Jul 05 '17 at 13:21
  • Try also adding [cordova-android-support-gradle-release](https://github.com/dpa99c/cordova-android-support-gradle-release) in case it's the Support Library causing the issue. Be sure to rm&add the android platform to reset the Gradle config. – DaveAlden Jul 05 '17 at 13:30
  • After updating and adding the above the app build.gradle changed and removed some config so i had to put back in defaultConfig {multiDexEnabled true} and into dependencies {compile "com.android.support:multidex:1.0.1" }. I encountered some further issues after this but aren't relevant to this topic so will leave them out. Many thanks for your help on this matter – RLau Jul 05 '17 at 14:58

0 Answers0