Build error after added Crosswalk

After I added Crosswalk to ionic project by using: ionic browser add crosswalk.
Then when I build android: ionic build android.
The error occurred:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/acce
ssibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionI
mpl;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:50
4)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForArmv7Debug'.
 FAILED

BUILD FAILED

Total time: 25.633 secs
> com.android.build.api.transform.TransformException: com.android.ide.common.pro
cess.ProcessException: org.gradle.process.internal.ExecException: Process 'comma
nd 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' 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.
Error: Error code 1 for command: cmd with args: /s,/c,"D:\outtoplay\ionic\OutToP
lay\platforms\android\gradlew cdvBuildDebug -b D:\outtoplay\ionic\OutToPlay\plat
forms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=t
rue"

My ionic info:

Your system information:

Cordova CLI: 6.1.1
Gulp version:  CLI version 1.2.1
Gulp local:   Local version 3.9.1
Ionic CLI Version: 1.7.15
Ionic App Lib Version: 0.7.2
OS: Windows 8.1
Node Version: v4.4.1

Try to add crosswalk using: cordova plugin add cordova-plugin-crosswalk-webview instead of browser

Thanks for anwser, but another error occurred:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/acce
ssibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionI
mpl;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
 FAILED
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:50
4)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)




BUILD FAILED

Total time: 35.817 secs
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForArmv7Debug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.pro
cess.ProcessException: org.gradle.process.internal.ExecException: Process 'comma
nd 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' 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.
Error: Error code 1 for command: cmd with args: /s,/c,"D:\outtoplay\ionic\OutToP
lay\platforms\android\gradlew cdvBuildDebug -b D:\outtoplay\ionic\OutToPlay\plat
forms\android\build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true -Pandroid
.useDeprecatedNdk=true"

Remove the android-support-v4.jar in your Android platforms/android/libs directory. It works?

There is no the android-support-v4.jar file in platform/android/libs directory.
I build android with error so I think it not create android-support-v4.jar.
I just found android-support-v4.jar in platforms\android\phonegap-facebook-plugin\outtoplay564849-FacebookLib\libs directory.

I’ve solve it by Remove the plugin and reinstall the earlier version

cordova plugin add cordova-plugin-crosswalk-webview@1.2.0

hi @ciaodate

You need to remove crosswalk plugin by using this command
cordova plugin remove <PLUGIN_NAME>
for example:- cordova plugin remove org.apache.cordova.media
and then again add crosswalk plugin
$ cordova plugin add cordova-plugin-crosswalk-webview

ugrade your JDK to 1.8.0

Hi guys, I encountered the same problem with Crosswalk and Facebook Plugin.

I finally fixed the issue, by installing crosswalk with the following command:
ionic browser add crosswalk
and install facebook plugin from here:
https://github.com/jeduan/cordova-plugin-facebook4
which is a drop in replacement for the standard cordova-facebook-plugin.

So far, there were no problems with the “new” facebook plugin, i tried fresh connect, login, logout …
(and no errors any more with DexForArmv7 … etc.)

Hope that helps someone …

1 Like

Thank you Shortie for saving my life.

1 Like

I’m glad that I could help you. Ionic is an awesome framework, but the community is even better =)