I'm working on a project with ionic. After I installed the Facebook Plugin I'm not able to build the project for android anymore!
The command
ionic build android
gives me this error message
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
I'm reading a lot of tutorials/answers about this error and it seems to be related to the use of the Facebook Plugin with the Push Notification Plugin.
It's two days I'm trying a lot of different solutions, but none of those is working :(
Here are some information about my configuration:
plugin com.phonegap.plugins.PushPlugin version 2.5.0
plugin com.phonegap.plugins.facebookconnect version 0.11.0 (installed with the local repository, as indicated on github)
cordova version 5.0
ionic version 1.6.3
It looks like this problem is related to the "support-annotations" library loaded several times. Buy I really don't know how this is possible and where I can check it.
Can you help me? Do you have any idea of how to make this working? Is there a ionic/cordova configuration file where I can check the dependencies?
Thanks a lot in advance.
Multiple dex files error is raised because of using multiple support jar files in the ionic / cordova project
you need to change build.gradle under platforms/android
find the below line
apply plugin:'com.android.application'
after add these below lines
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
i solved same problem in my app the problem is
com.android.support:support-v4:+
com.android.support:support-v4:+ file exist in /platforms/android/phonegap-facebook-plugin/Myapp-FacebookLib/libs
if you want only used facebook and Push Notification Plugin then simply commit the line in project.properties
#cordova.system.library.1=com.android.support:support-v4:+
Best way to solved this problem
1 First delete the android-support-v4.jar from /platforms/android/phonegap-facebook-plugin/Myapp-FacebookLib/libs
2 second step create a file name build-extras.gradle in /platforms/android/phonegap-facebook-plugin/Myapp-FacebookLib/
and type in file
dependencies {
compile "com.android.support:support-v4:+" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With