Thursday, September 24, 2015

Cordova / Ionic - Multiple Dex Issue with "Facebook Connect" and "LocalNotification" plugins.

Had a problem with Cordova / Ionic today:

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:502)
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)

After some hours of reading and testing found solution that worked for me in following configuration:

com.phonegap.plugins.facebookconnect 0.11.0 "Facebook Connect"
de.appplant.cordova.plugin.local-notification 0.8.2-dev "LocalNotification"

Fix was quite simple (after a couple of hours :) :

plugins/com.phonegap.plugins.facebookconnect/plugin.xml:

-   <framework custom="true" src="platforms/android/FacebookLib">
+   <framework src="com.android.support:support-v4:+">
+   <framework src="com.facebook.android:facebook-android-sdk:3.23.0">

plugins/de.appplant.cordova.plugin.local-notification/plugin.xml:

-   <dependency id="cordova-plugin-android-support-v4">
+   <framework src="com.android.support:support-v4:+">

PS: de.appplant.cordova.plugin.local-notification will install cordova-plugin-android-support-v4 - you can remove it after this with ionic plugin remove cordova-plugin-android-support-v4

7 comments:


  1. Hats off to your presence of mind..I really enjoyed reading your blog. I really appreciate your information which you shared with us.
    ionic training in chennai

    ReplyDelete
  2. Thanks for Providing all kind of information's Here...This Helps to learn something Different like Technically and Non Technically...Keep Doing
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete

  3. The well-known Business Process Management (BPM) tool PEGA was developed using Java ideas and enables users to modify more quickly than Java-based apps. PEGA is used primarily to cut expenses and advance commercial objectives. PEGA was developed using OOP and Java concepts. To learn more about Pega, join Pega Training In Chennai at FITA Academy.

    Pega Training In Chennai

    ReplyDelete

  4. Corporate training is the process of educating employees using a variety of learning programmes through a system of activities. It serves as a catalyst for employee achievement, which in turn signifies your company's or organisation's overall success. According to a LinkedIn survey, 94% of employees said they would remain at a firm if it invested in their learning requirements because training is seen as a crucial aspect of their professional lives. To know more about corporate training features, join Corporate Training Companies In Chennai at FITA Academy.

    Corporate Training Companies In Chennai

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete