Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2.01k forks source link

Phonegap Build Error Build For Android #1095

Open roomoraaes opened 9 years ago

roomoraaes commented 9 years ago

I'm having trouble getting the build phonegap . The phonegap can not run the build for android . Ios and WP is working normal. Android with this problem, someone is having the same problem ?

Justin-Credible commented 9 years ago

Yes, I am experiencing the same issue. Builds fine for iOS, but build fails for Android.

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/junterreiner-x/Library/Android/sdk/build-tools/22.0.1/dx --dex --no-optimize --output /Users/junterreiner-x/Development/mobile-app/platforms/android/build/intermediates/dex/debug --input-list=/Users/junterreiner-x/Development/mobile-app/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/annotation/AnimRes;
        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:454)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
        at com.android.dx.command.dexer.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)
Justin-Credible commented 9 years ago

I found a work around in #1090:

Add the following to the bottom of platforms/android/build.gradle and then run cordova build android again:

configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }
SMJ93 commented 9 years ago

Do you mean build.gradle? If so It doesn't seem to work for me. Also in the build.gradle it says at the top // GENERATED FILE! DO NOT EDIT!

Justin-Credible commented 9 years ago

Oops, had a typo. Yes build.gradle.

Justin-Credible commented 9 years ago

If you don't want to edit build.gradle you can put the configurations line in a file called build-extras.gradle right next to the existing build.gradle file.

Ultimately I switched to this fork of the Facebook plugin which also fixed the issue:

https://github.com/jeduan/cordova-plugin-facebook4

SMJ93 commented 9 years ago

The build gradle doesn't regenerate like it says in the file so the solution works!

http://www.thedevline.com/2014/06/unexpected-top-level-exception.html

Thanks!

ShivaliPatel commented 8 years ago

@Justin-Credible : Thanks..this works for me..

develbass commented 8 years ago

I found a work around in:

Add the following to the bottom of platforms/android/build.gradle and then run cordova build android again:

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

thank you @Justin-Credible

delajose90 commented 8 years ago

@Justin-Credible works for me dude, thanks.

miqmago commented 8 years ago

Could you show the list of plugins you're using?