Reporting bug : crosswalk issue with other plugins


#1

Hey guys,

wanted to report a bug I encountered. Bug met when using xwalk for Android with other plugins (specifically in my case, Facebook plugin and Push plugin, but I can’t be sure that its only this configuration that gets the bug). To reproduce (on Windows) :

Here is the interesting part of the result :

:dexArmv7Debug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/view
/PagerAdapter;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:45
4)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
        at com.android.dx.command.dexer.Main.run(Main.java:245)
        at com.android.dx.command.dexer.Main.main(Main.java:214)
        at com.android.dx.command.Main.main(Main.java:106)

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dexArmv7Debug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        C:\Development\adt-bundle\sdk\build-tools\21.1.0\dx.bat --dex --no-optim
ize --output C:\Users\Jeremy\buildtest4\platforms\android\build\intermediates\de
x\armv7\debug --input-list=C:\Users\Jeremy\buildtest4\platforms\android\build\in
termediates\tmp\dex\armv7\debug\inputList.txt
Error Code:
        2
Output:

        UNEXPECTED TOP-LEVEL EXCEPTION:
        com.android.dex.DexException: Multiple dex files define Landroid/support
/v4/view/PagerAdapter;
                at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.ja
va:596)
                at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:
554)
                at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:
535)
                at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)

                at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
                at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main
.java:454)
                at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
                at com.android.dx.command.dexer.Main.run(Main.java:245)
                at com.android.dx.command.dexer.Main.main(Main.java:214)
                at com.android.dx.command.Main.main(Main.java:106)




BUILD FAILED

Total time: 9.544 secs
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

C:\Users\Jeremy\buildtest4\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "C:\Users\Jeremy\buildtest4\platf
orms\android\gradlew cdvBuildDebug -b C:\Users\Jeremy\buildtest4\platforms\andro
id\build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true"
ERROR running one or more of the platforms: Error: C:\Users\Jeremy\buildtest4\pl
atforms\android\cordova\run.bat: Command failed with exit code 8
You may not have the required environment or OS to run this project

Hope that helps !


#2

me too…

crosswalk
facebook plugin
push plugin

occured same error

help!


#3

For now I work without xwalk, you should do the same since it don’t prevent you to work, and hope Ionic resolve the bug fast enough :frowning:


#4

same here :frowning:


#5

I don’t know if this can help. Changing the <framework src="platforms/android/FacebookLib" custom="true" /> to <framework src="com.facebook.android:facebook-android-sdk:3.23.0" /> solved the issue for me.


#6

For the ones interested, I managed to solve this issue by changing my build.gradle file.
Change this :
dependencies {
compile fileTree(dir: ‘libs’, include: ‘*.jar’) …}
To
dependencies {
compile fileTree(dir: ‘libs’, include: ‘gcm.jar’) …}

The * was making gradle to take all the libs in the folder which was including android-support-v13.jar as well.
As Pushplugin uses support-v4 there was an incompatibility.
So now only support-v4 is included and it’s ok.


#7

Thanks, when the time comes I will definitely try this !


#8

Thank you it works.

What I had to do :

  • remove android platform
  • add the others plugins
  • add the Facebook plugin
  • edit the file plugin.xml inside the folder “com.phonegap.plugins.facebookconnect”
  • in package.json remove the plugin from the list “cordovaPlugins”
  • add android platform

#9

Thanks you @pasqualemangialavori and @spicycake - the combination of your two fixes fixed this for me. whats a nightmare… thank you so much for sharing - saved my day,


#10

I approve this answer