Using Meteor, Cordova and Facebook for multiple dex

153 views Asked by At

I'm using Meteor and Cordova to develop an android app. Using Mac OS El Capitan, latest Meteor (1.2.1).

I'm having an error while trying to build the app to Android, I manage to see that the error is because of the Facebook connect plugin that I'm using. I'm using this version of the plugin:

com.phonegap.plugins.facebookconnect@https://github.com/Wizcorp/phonegap-facebook-plugin/tarball/c0f8da97a1d65397ada73e958dafed3aeef2e491

and I get this error:

Errors executing Cordova commands:
While running Cordova app for platform Android with options --device: Error: Command failed: /Users/maor/dev/EDD/everydamnday/.meteor/local/cordova-build/platforms/android/cordova/run --device Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; 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:504) 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 ':dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/maor/Library/Android/sdk/build-tools/23.0.2/dx --dex --no-optimize --output /Users/maor/dev/EDD/everydamnday/.meteor/local/cordova-build/platforms/android/build/intermediates/dex/debug --input-list=/Users/maor/dev/EDD/everydamnday/.meteor/local/cordova-build/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; 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:504) 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)

   * Try:    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
   /Users/maor/dev/EDD/everydamnday/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:126

throw e; ^ Error code 1 for command: /Users/maor/dev/EDD/everydamnday/.meteor/local/cordova-build/platforms/android/gradlew with args:
cdvBuildDebug,-b,/Users/maor/dev/EDD/everydamnday/.meteor/local/cordova-build/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true at ChildProcess.exitCallback (/tools/utils/processes.js:137:23) at ChildProcess.emit (events.js:98:17) at Process.ChildProcess._handle.onexit (child_process.js:820:12)

ExitWithCode:

I tried everything. All the issues about the conflict with the android-support.v4.jar with other plugins didn't work. I tried to do Meteor reset. I tried to remove the platform and add it again but nothing worked. Only if I take down the Facebook connect plugin it works!

1

There are 1 answers

0
DFish On

Having the same issue when I run:

meteor build ...

Found the fix at:

https://github.com/Wizcorp/phonegap-facebook-plugin/issues/1234

When I open my project in android studie, and under Gradle Scripts add the file

build-extras.gradle 

with

configurations { all*.exclude group: 'com.android.support', module:'support-v4' }

I can now successfully build using Android Studio.