Ionic Package: Execution failed for task "transform Classes WithDex For Debug"

I had the same problem as the OP and I followed all the steps but now I am getting a different error. I’ve been searching all over and see similar issues but none of the solutions are fixing this for me and I am really confused as to what the actual problem is.

Cordova CLI: 7.0.1 
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.9
Node Version: v6.11.1
Xcode version: Not installed

I am running ‘ionic package build android’ and getting a long error that boils down to this.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> java.util.concurrent.ExecutionException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

Installed platforms:
  android 6.2.3
  ios 4.3.1
Available platforms: 
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  ubuntu ~4.3.4 (deprecated)
  webos ~3.7.0

Can anyone explain what dex files are?

The error seems to be caused by this

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

This is related but doesn’t solve my problem.

Check for cordova plugin list and remove the v4 plugin

1 Like

Thanks I removed cordova-plugin-android-support-v4-jar 23.2.1 “Android Support v4” and now I am getting a different error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute value=(25.3.1) from [] AndroidManifest.xml:27:9-31
        is also present at [] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.

This is my current cordova plugin list

ordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-contacts 2.3.1 "Contacts"
cordova-plugin-crosswalk-webview 2.3.0 "Crosswalk WebView Engine"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
ionic-plugin-deploy 0.6.7 "IonicDeploy"
ionic-plugin-keyboard 2.2.1 "Keyboard"

It looks like this is a problem with two plugins having a conflict(at least from what I can tell so far) but I haven’t installed any new plugins and builds have always worked for me.
All I did was update cordova and android when I had a gradle problem. Really lost here

Can you remove android platform and add it again and reinstall those plugins

I’ve done that a few times by just using

ionic platform rm android
ionic platform add android

do I need to uninstall and re install every plugin individually? I might just try that because this is driving me nuts.

It happened with me recently, and i tried couple of ways and my last way was to remove the v4 plugin which worked.
I think your app cordova-plugin-compat 1.1.0 “Compat” plugin is doing some issues. Kindly, remove it and add everything again

Ok thank you I removed the one plugin I had that had “V4” in the title, it seems that my problem runs deeper

I removed the “Compat” plugin and then reinstalled the android platform. Same error, really weird…

Remove all plugins(File, FileTransfer etc) and reinstall again


Trying that right now

Ok I removed all the plugins and the build was successful and then I added them back one by one until it finally failed when I added “cordova-plugin-document-viewer” which included “cordova-plugin-android-support-v4-jar” So it was something with the V4. I am trying to figure out how to work around this and might just use a different plugin.

Thanks for the help!

This plugin was my problem


why not use

1 Like

I’ll try that out, thanks

Also this plugin is causing a different but similar issue


which is why I was having problems figuring out which plugin was causing the problem.

Put this at the end of your app module build.gradle:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if ( == ‘’) {
if (!“multidex”)) {
details.useVersion ‘25.3.0’