2 Replies Latest reply on Oct 10, 2016 6:17 AM by conectts21489835

    Phonegap build problem with Graple, Pushplugin and Safariviewcontroller

    conectts21489835

      Hello everyone,

      I'm facing some problems these days when I try to build my app for Android. The following Exception shows off after the build:

       

      :preDexRelease

      :dexRelease

      UNEXPECTED TOP-LEVEL EXCEPTION:

      com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServ iceInfoVersionImpl;

      at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)

      at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)

      at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)

      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)

       

      FAILED

       

      But last week everything was fine. In one of my tests I've noticed that if I remove one of these plugins below, the build works:

       

        <gap:plugin name="cordova-plugin-safariviewcontroller" source="npm" />

        <plugin name="com.phonegap.plugins.pushplugin" spec="2.5.0" source="pgb" />

       

      Some people over the internet told me that I need to remove support for v4. Just like this topic on stackoverflow: android - Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat - Stack Over…

       

      But is there a way to exclude v4 dependency on config.xml, so I can build on phonegap website without problems?

       

      Thanks for your attention.

      Wiliam.

        • 1. Re: Phonegap build problem with Graple, Pushplugin and Safariviewcontroller
          kerrishotts Adobe Community Professional

          Don't source plugins from PGB -- they are old and outdated. Use NPM instead: phonegap-plugin-push

           

          Furthermore, SafariViewController should not be interfering in any way, since it isn't supported on Android (it's iOS only).

           

          Also, make sure to pin your app to a specific version of PGB. See: Adobe PhoneGap Build

          • 2. Re: Phonegap build problem with Graple, Pushplugin and Safariviewcontroller
            conectts21489835 Level 1

            Thank you so much for your reply, Kerri. You gave me some nice insights for what and where I had to investigate.

             

            After that I was able to learn a lot about the best practices for phonegap and ended pinning every plugin for specific versions.

             

            It appears that these settings won't build because SafariViewController was having some conflicts with CustomTabs stuff.

             

              <gap:plugin name="cordova-plugin-safariviewcontroller" source="npm" />

              <plugin name="com.phonegap.plugins.pushplugin" spec="2.5.0" source="pgb" />

             

            So I changed this for this and everything worked like a charm.

             

                      <plugin name="cordova-plugin-push-notification" spec="2.5.2" />

                         <plugin name="cordova-plugin-safariviewcontroller" spec="1.4.1" />

             

            The next steps will be to update the code from the old PushPlugin to the new one and to update the Phonegap version.

             

            Best,

            Wiliam.